From: alex at fav dot or dot it Operating system: PHP version: 5.2.5 PHP Bug Type: Strings related Bug description: Serializing objects with protected members introduces null charcters
Description: ------------ The output from the serialization of objects that contain protected (and possibly private also) members contains null characters. These characters are unnecessary and can cause problems when inserting the serialized data into databases. An asterisk is placed before the variable name in the serialized string, which I assume is to mark it as protected. This asterisk is surrounded by null characters. This appears to be the same as the closed #29865 (closed 10/2005), but in version 5.2.5 and the latest snapshot, the bug still exists. Reproduce code: --------------- php -r 'class Foo { protected $bar = 1; } $v = new Foo; echo serialize($v);' | hexdump Expected result: ---------------- The output should not contain null characters (shown as '00') around the asterisk. Actual result: -------------- 0000000 3a4f 3a33 4622 6f6f 3a22 3a31 737b 363a 0000010 223a 2a00 6200 7261 3b22 3a69 3b31 007d 000001f -- Edit bug report at http://bugs.php.net/?id=44792&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44792&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44792&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44792&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44792&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44792&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44792&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44792&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44792&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44792&r=support Expected behavior: http://bugs.php.net/fix.php?id=44792&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44792&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44792&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44792&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44792&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44792&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44792&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44792&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44792&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44792&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44792&r=mysqlcfg