开发者

unserialize offset Error

开发者 https://www.devze.com 2023-04-13 00:59 出处:网络
-- I have a serialized array开发者_开发问答 sent to another function in my application. Then I try to unserialize the data and present it in another place.

--

I have a serialized array开发者_开发问答 sent to another function in my application. Then I try to unserialize the data and present it in another place.

The unserialize function works correctly for smaller ammout of data, like couple of hundreds records. When it comes to 3000+ records I've got the following error message:

Notice (8): unserialize() [function.unserialize]: Error at offset 23048 of 3499833 bytes [APP/controllers/jobs_controller.php, line 475]

Warning (2): Cannot modify header information - headers already sent by (output started at /home/v/s/vsdev/web/public_html/cake/libs/debugger.php:683) [APP/views/helpers/xls.php, line 19]

Warning (2): Cannot modify header information - headers already sent by (output started at /home/v/s/vsdev/web/public_html/cake/libs/debugger.php:683) [APP/views/helpers/xls.php, line 20]

Warning (2): Cannot modify header information - headers already sent by (output started at /home/v/s/vsdev/web/public_html/cake/libs/debugger.php:683) [APP/views/helpers/xls.php, line 21]

Warning (2): Cannot modify header information - headers already sent by (output started at /home/v/s/vsdev/web/public_html/cake/libs/debugger.php:683) [APP/views/helpers/xls.php, line 22]

Warning (2): Cannot modify header information - headers already sent by (output started at /home/v/s/vsdev/web/public_html/cake/libs/debugger.php:683) [APP/views/helpers/xls.php, line 23]

Warning (2): Cannot modify header information - headers already sent by (output started at /home/v/s/vsdev/web/public_html/cake/libs/debugger.php:683) [APP/views/helpers/xls.php, line 24]

Warning (2): Cannot modify header information - headers already sent by (output started at /home/v/s/vsdev/web/public_html/cake/libs/debugger.php:683) [APP/views/helpers/xls.php, line 25]

Link Job Job Ref Company Link Profession Specialism Sub Specialism Zone Country Region City Seniority Date Published Date Archived Days Active Email Enabled Created Modified

Warning (2): Invalid argument supplied for foreach() [APP/views/jobs/search_export.ctp, line 37]

What's wrong?


The data in the record that throws the error is almost certainly corrupted. This should have nothing to do with the number of records you request, just one or more specific records that have invalid serialized data. Try finding out which record results in the error, and check its data.

On a side note: What column type are you using to store your serialized data? I've found that when using TEXT in MySQL, serialized data can be irreversibly damaged by the operations MySQL performs on text, resulting in unserialize() errors. Use BLOB for serialized data columns, that way the data remains unchanged.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号