#28106 [Fbk->NoF]: New object model fails where old style works fine
| From: | php-bugs at lists dot php dot net | Date: | Tue, 18 Jan 2005 00:00:14 +0000 |
| Subject: | #28106 [Fbk->NoF]: New object model fails where old style works fine | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-72335@lists.php.net to get a copy of this message | ||
ID: 28106
Updated by: php-bugs@lists.php.net
Reported By: kupka at learninglab dot de
-Status: Feedback
+Status: No Feedback
Bug Type: Zend Engine 2 problem
Operating System: Mac OS X
PHP Version: 5.0.0RC3
New Comment:
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
Previous Comments:
------------------------------------------------------------------------
[2005-01-10 15:20:02] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
------------------------------------------------------------------------
[2004-07-12 20:00:38] antonr at game dot permonline dot ru
to kupka at learninglab dot de:
please check your script with last php5 snapshots... i suppose this bug
was corrected
------------------------------------------------------------------------
[2004-06-10 12:23:31] kupka at learninglab dot de
In PHP 5 Release Candidate 3 the problem still exists.
------------------------------------------------------------------------
[2004-05-08 10:32:19] antonr at game dot permonline dot ru
So, there is a problem with serialization and deserialization of
objects with references to others objects.
------------------------------------------------------------------------
[2004-05-08 10:27:17] antonr at game dot permonline dot ru
5.0.0 RC2, Win32
----------------------------------
<?php
class MyClass
{ public $number;
function EchoNum()
{ echo $this->number;
echo "<br>";
}
}
$a = new MyClass;
$a->number = 1;
$b = $a;
$b->number = 2;
$a->EchoNum();
$b->EchoNum();
?>
outputs:
2
2
----------------------------------
but...
<?php
class MyClass1
{ public $myclass2;
}
class MyClass2
{ public $myclass1;
}
$a = new MyClass1;
$a->myclass2 = new MyClass2;
$a->myclass2->myclass1 = $a;
$a->number = 1;
echo $a->myclass2->myclass1->number;
echo "<br>";
$c = serialize($a);
echo $c;
echo "<br><br>";
$b = unserialize($c);
$b->number = 2;
echo $b->number;
echo "<br>";
echo $b->myclass2->myclass1->number;
echo "<br>";
echo "<br>";
?>
outputs:
1
O:8:"MyClass1":2:{s:8:"myclass2";O:8:"MyClass2":1:{s:8:"myclass1";O:8:"MyClass1":2:{s:8:"myclass2";r:2;s:6:"number";i:1;}}s:6:"number";i:1;}
2
1
----------------------------------
while:
<?php
class MyClass1
{ public $myclass2;
}
class MyClass2
{ public $myclass1;
}
$a = new MyClass1;
$a->myclass2 = new MyClass2;
$a->myclass2->myclass1 = &$a; <--- ampersand symbol added
$a->number = 1;
echo $a->myclass2->myclass1->number;
echo "<br>";
$c = serialize($a);
echo $c;
echo "<br><br>";
$b = unserialize($c);
$b->number = 2;
echo $b->number;
echo "<br>";
echo $b->myclass2->myclass1->number;
echo "<br>";
echo "<br>";
?>
works fine and outputs:
1
O:8:"MyClass1":2:{s:8:"myclass2";O:8:"MyClass2":1:{s:8:"myclass1";r:1;}s:6:"number";i:1;}
2
2
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/28106
--
Edit this bug report at http://bugs.php.net/?id=28106&edit=1