ID:               45672
 Updated by:       [EMAIL PROTECTED]
 Reported By:      thomas at raptr dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         *General Issues
 Operating System: FC8
 PHP Version:      5.2.6
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php




Previous Comments:
------------------------------------------------------------------------

[2008-07-31 21:29:01] thomas at raptr dot com

Description:
------------
5.2.6's unserialize() has a different behaviour than 5.2.5's.
In 5.2.6, unserialize() turns integer-based key in a stdClass into
an key of integer type. In 5.2.5, the key left an string type. 

Reproduce code:
---------------
<?php

class A {

  public function execute() {
    $a = new stdClass();
    $a->{self::B} = "c";
echo "Before:\n";
var_dump($a);

    $str = serialize($a);
    $a = unserialize($str);
echo "After:\n";
var_dump($a);

echo $a->{self::B} . "\n";

  }

  const B = "1";
}

$a = new A();
$a->execute();

?>


Expected result:
----------------
Before:
object(stdClass)#2 (1) {
  ["1"]=>
  string(1) "c"
}
After:
object(stdClass)#3 (1) {
  ["1"]=>
  string(1) "c"
}
c


Actual result:
--------------
Before:
object(stdClass)#2 (1) {
  ["1"]=>
  string(1) "c"
}
After:
object(stdClass)#3 (1) {
  [1]=>
  string(1) "c"
}

Notice: Undefined property: stdClass::$1 in /tmp/a.php on line 17

Call Stack:
    0.0010      50016   1. {main}() /tmp/a.php:0
    0.0386      50240   2. A->execute() /tmp/a.php:25



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45672&edit=1

Reply via email to