unserialize offset错误

时间:2011-10-15 16:02:08

标签: php cakephp serialization

-

我有一个序列化数组发送到我的应用程序中的另一个函数。 然后我尝试反序列化数据并将其呈现在另一个地方。

unserialize函数可以正常处理较小的数据,例如数百条记录。当涉及到3000多条记录时,我收到以下错误消息:

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]

怎么了?

1 个答案:

答案 0 :(得分:1)

抛出错误的记录中的数据几乎肯定已损坏。这应该与您请求的记录数无关,只与一个或多个具有无效序列化数据的特定记录无关。尝试找出哪个记录​​导致错误,并检查其数据。

旁注:您使用哪种列类型来存储序列化数据?我发现在MySQL中使用TEXT时,MySQL对文本执行的操作会不可逆地破坏序列化数据,从而导致unserialize()错误。将BLOB用于序列化数据列,这样数据保持不变。