#45244 [NEW]: serialize() inserts NUL chars when serializing objects

From: Date: Thu, 12 Jun 2008 09:47:41 +0000
Subject: #45244 [NEW]: serialize() inserts NUL chars when serializing objects
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-125704@lists.php.net to get a copy of this message
From: bukaj at bukaj dot net Operating system: OS X, FreeBSD PHP version: 5.2.6 PHP Bug Type: Strings related Bug description: serialize() inserts NUL chars when serializing objects Description: ------------ This issue has been marked as closed in bug #29865 but THE PROBLEM IS STILL PRESENT IN 5.2.6. Serialize inserts NUL (ASCII 0) characters into output when serializing objects. Serialize CAN'T produce output with unprintable chars - that's the idea of serialize! This issue has been marked as resolved in bug #29865 but IT IS NOT. Reproduce code: --------------- $ php -r 'class Foo { protected $bar = 1; } $v = new Foo; echo serialize($v);' | hexdump Expected result: ---------------- No unprintable chars in result of serialize!!! Actual result: -------------- 0000000 4f 3a 33 3a 22 46 6f 6f 22 3a 31 3a 7b 73 3a 36 0000010 3a 22 00 2a 00 62 61 72 22 3b 69 3a 31 3b 7d 000001f mark the two 00's at 0x12 and 0x14 -- Edit bug report at http://bugs.php.net/?id=45244&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45244&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45244&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45244&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45244&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45244&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45244&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45244&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45244&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45244&r=support Expected behavior: http://bugs.php.net/fix.php?id=45244&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45244&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45244&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45244&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45244&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45244&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45244&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45244&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45244&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45244&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45244&r=mysqlcfg

« previous php.bugs (#125704) next »