From: davojan at mail dot ru Operating system: FreeBSD 4.7-RELEASE PHP version: 5.0.0b4 (beta4) PHP Bug Type: Session related Bug description: Incorrect unserialization after __sleep()
Description: ------------ When unserializing after __sleep(), private and protected fields are duplicated with the public ones with the same name. Note, that in php5.0.0b2 the example works fine. I think it's because of "foreach", which: - in php5b4: gives the plane names of fields; - in php5b2: there was a string with additional information about scope ("*", for example) and with '\0' delimiters. Reproduce code: --------------- <? class foo { public $x = 1; protected $y = 2; private $z = 3; function __sleep() { foreach ($this as $Key => $Value) { $Result[] = $Key; } return $Result; } } session_start(); $_SESSION['foo'] = new foo(); print_r ($_SESSION['foo']); session_write_close(); session_start(); print_r ($_SESSION['foo']); ?> Expected result: ---------------- foo Object ( [x] => 1 [y:protected] => 2 [z:private] => 3 ) foo Object ( [x] => 1 [y:protected] => 2 [z:private] => 3 ) Actual result: -------------- foo Object ( [x] => 1 [y:protected] => 2 [z:private] => 3 ) foo Object ( [x] => 1 [y:protected] => 2 [z:private] => 3 [y] => [z] => ) -- Edit bug report at http://bugs.php.net/?id=27350&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27350&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27350&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27350&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27350&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27350&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27350&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27350&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27350&r=support Expected behavior: http://bugs.php.net/fix.php?id=27350&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27350&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27350&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27350&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27350&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27350&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27350&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27350&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27350&r=float