ID: 45199
Updated by: [EMAIL PROTECTED]
Reported By: mehran20 at hotmail dot com
-Status: Bogus
+Status: Open
Bug Type: Class/Object related
Operating System: CentOS / Linux
PHP Version: 5.2.6
Previous Comments:
------------------------------------------------------------------------
[2008-06-09 10:24:07] mehran20 at hotmail dot com
Jani, I know what PRIVATE means and I know what I've submitted is a
bug, not a BOGUS!! Please take another look at this bug, it did not
exist in 5.2 and when I upgraded to 5.2.6 it suddenly hit me.
Please take a close look at it, this is a php bug!!!
------------------------------------------------------------------------
[2008-06-09 08:53:35] [EMAIL PROTECTED]
RTFM: "Private limits visibility only to the class that defines the
item."
------------------------------------------------------------------------
[2008-06-07 09:02:39] mehran20 at hotmail dot com
Description:
------------
Hi
Before you read the code, I want to say that the code that is given in
this section works fine. The only problem is for the code that is given
in the "Reproduce code".
class A {
private $a = 1;
}
class B extends A {
private $b = 2;
}
$v = new B;
print_r(unserialize(serialize($v)));
Output (which is correct):
B Object ( [b:private] => 2 [a:private] => 1 )
Reproduce code:
---------------
class A {
private $a = 1;
public function __sleep() {
$vars = get_object_vars($this);
return array_keys($vars);
}
}
class B extends A {
private $b = 2;
}
$v = new B;
print_r(unserialize(serialize($v)));
Expected result:
----------------
B Object ( [b:private] => 2 [a:private] => 1 )
Or
B Object ( [b:private] => 2 )
I prefer the first one! But both could be correct!!
Actual result:
--------------
Notice: serialize() [function.serialize]: "a" returned as member
variable from __sleep() but does not exist in <__FILE__> on line 14
B Object ( [b:private] => 2 [a:private] => 1 [a] => )
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45199&edit=1