From: Operating system: PHP version: Irrelevant Package: SPL related Bug Type: Bug Bug description:SplFixedArray getSize(), count() after unserialization return 0
Description: ------------ If SplFixedArray object is created via unserialize() of serialized instance then the getSize() and count() methods return 0 instead of expected actual size. Tested on Debian Squeeze 6 64bit: x86-5.4.0RC3-dev Tested on windows 7 64bit: x86-5.4.0RC3-nts x86-5.4.0trunk(12.12)-nts x86-5.4.0snap(13.12)-nts x86-5.3.8-nts x86-5.3.6-ts x86-5.3.6-nts x64-5.3.6-nts x86-5.3.4-nts x86-5.3.1-ts Test script: --------------- <?php $a = new SplFixedArray(2); $a[0] = 1; $a[1] = 2; echo '$a = ', var_dump($a); echo 'Sizeof $a = ' . $a->getSize(), PHP_EOL; echo 'Count $a = ' . $a->count(), PHP_EOL; echo PHP_EOL; $b = unserialize(serialize($a)); echo '$b = ', var_dump($b); echo 'Sizeof $b = ' . $b->getSize(), PHP_EOL; echo 'Count $b = ' . $b->count(), PHP_EOL; Expected result: ---------------- $a = object(SplFixedArray)#1 (2) { [0]=> int(1) [1]=> int(2) } Sizeof $a = 2 Count $a = 2 $b = object(SplFixedArray)#2 (2) { [0]=> int(1) [1]=> int(2) } Sizeof $b = 2 Count $b = 2 Actual result: -------------- $a = object(SplFixedArray)#1 (2) { [0]=> int(1) [1]=> int(2) } Sizeof $a = 2 Count $a = 2 $b = object(SplFixedArray)#2 (2) { [0]=> int(1) [1]=> int(2) } Sizeof $b = 0 Count $b = 0 -- Edit bug report at https://bugs.php.net/bug.php?id=60560&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60560&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60560&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60560&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60560&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60560&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60560&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60560&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60560&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60560&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60560&r=support Expected behavior: https://bugs.php.net/fix.php?id=60560&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60560&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60560&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60560&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60560&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=60560&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60560&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60560&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60560&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60560&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60560&r=mysqlcfg