|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-06-08 21:46 UTC] scottmac@php.net
-Status: Open
+Status: Bogus
[2011-06-08 21:46 UTC] scottmac@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 03:00:01 2025 UTC |
Description: ------------ When you serialize an object with private or protected members, their length names are baddly calculated (maybe because of "These prepended values [which] have null bytes on either side" like the documentation says. Anyway, this is a problem when you want to write your serialisation into a file and analyse it next. Note that I'm not using PHP 5.2.17 but 5.2.3. But I haven't read a fix of this problem between both version. Test script: --------------- Here is an example: class Ab { private $_i = 0; public function __construct() { $this->_i = 1; } }; $oAB = new Ab(); $str = serialize($oAB); echo $str; Expected result: ---------------- O:2:"Ab":1:{s:4:"Ab_i";i:1;} Actual result: -------------- O:2:"Ab":1:{s:6:"Ab_i";i:1;} Note the "s:6" instead of "s:4": this is why the unserialization from this string is impossible.