#25975 [Csd]: PHP 5 object references don't survive serialization
| From: | reiersol at online dot no | Date: | Mon, 02 Feb 2004 09:00:38 +0000 |
| Subject: | #25975 [Csd]: PHP 5 object references don't survive serialization | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-54287@lists.php.net to get a copy of this message | ||
ID: 25975
User updated by: reiersol at online dot no
Reported By: reiersol at online dot no
Status: Closed
Bug Type: Zend Engine 2 problem
Operating System: Linux RedHat 9.0
PHP Version: 5CVS
New Comment:
OK, I'm beginning to think I understand what the problem is. You're
testing my "expected result" from before the attempted bugfix in early
November. That doesn't work.
Since the history of the bug seems to be causing confusion, I've now
reported the "fixed" version as a new bug:
http://bugs.php.net/27120
Previous Comments:
------------------------------------------------------------------------
[2004-02-01 05:28:32] stas@php.net
Works for me too, just as in your "Expected result".
------------------------------------------------------------------------
[2004-01-22 03:36:38] reiersol at online dot no
In response to cunha17 at uol dot com dot br:
As far as I can tell, nothing has happened since my November 10
submission. The examples I've given already *should* be more than
sufficient. Perhaps it would be helpful
if you double-check this. To make it really easy, here's a
PHPUnit test to run. Both tests should pass. In PHP 5 beta 1, the
testReplaceObject passes, the other one fails. In the versions after
the dubious fix (including today's CVS version), it's reversed.
require_once 'PHPUnit.php';
class Bar { var $value = 0; }
class Foo {
var $v1;
var $v2;
function Foo() {
$this->v1 = new Bar;
$this->v2 = $this->v1;
}
}
class ReferenceTest extends PHPUnit_TestCase {
function testChangeObject() {
$g = unserialize(serialize(new Foo));
$g->v2->value = 42;
$this->assertEquals(42,$g->v1->value);
}
function testReplaceObject() {
$g = unserialize(serialize(new Foo));
$g->v2 = 42;
$this->assertTrue($g->v1 instanceof Bar);
}
}
$suite = new PHPUnit_TestSuite();
$suite->addTestSuite('ReferenceTest');
$result = PHPUnit::run($suite);
echo $result->toString();
------------------------------------------------------------------------
[2004-01-21 20:16:26] cunha17 at uol dot com dot br
If it's not fixed, please don't give up !
Serialization/Deserialization should work transparently in the same
script or using sessions !!!
Just provide a simple script with the actual and expected results...
------------------------------------------------------------------------
[2004-01-19 05:23:13] reiersol at online dot no
For the record: I don't think this bug has been fixed, and I think it's
a very serious one, but I'm giving up.
------------------------------------------------------------------------
[2004-01-11 11:00:25] sniper@php.net
Seems to be fixed now.
------------------------------------------------------------------------
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/25975
--
Edit this bug report at http://bugs.php.net/?id=25975&edit=1