From: Operating system: Ubuntu PHP version: 5.3.2 Package: Arrays related Bug Type: Bug Bug description:New lines in serialize()
Description: ------------ I just hit an unexpected problem: serialize() counts new lines as characters, although in the serialized output, those characters do not appear. The character count of the serialized string is then wrong and unserialize() ist not possible. Test script: --------------- $textOne = "String to serialize with multiple lines!"; $array = Array(0 => $textOne); echo serialize($array); /* This will print out: a:1:{i:0;s:42:"String to serialize with multiple lines!";} The problem with that is, that the serialized String is actually 40, not 42 characters long. Because of that, you cannot unserialize the whole serialized Array. */ Expected result: ---------------- a:1:{i:0;s:40:"String to serialize with multiple lines!";} Actual result: -------------- a:1:{i:0;s:42:"String to serialize with multiple lines!";} -- Edit bug report at http://bugs.php.net/bug.php?id=52286&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52286&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52286&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52286&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52286&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52286&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52286&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52286&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52286&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52286&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52286&r=support Expected behavior: http://bugs.php.net/fix.php?id=52286&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52286&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52286&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52286&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52286&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52286&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52286&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52286&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52286&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52286&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52286&r=mysqlcfg