php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7351 after $obj->obj2->method() call, serialize() doesn't see $obj->obj2 any more
Submitted: 2000-10-19 18:09 UTC Modified: 2000-10-23 05:29 UTC
From: dolecek at ibis dot cz Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.3pl1 OS: NetBSD 1.5H
Private report: No CVE-ID: None
 [2000-10-19 18:09 UTC] dolecek at ibis dot cz
I use PHP4.0.3pl1 loaded as DSO module to Apache 1.3.12.

I have an object, which contains another object.
I found out, that if a method is called via
the parent object (like $obj->obj2->method()),
serialize() no longer sees
the child object and hence doesn't include it
to it's output. This is quite a problem, since
this is default session storage method (I believe
php_binary is affected too, though I've not tested
that).

Strange is that print_r() still prints the object
correctly.
This problem was NOT in 4.0.1pl2 - it's working okay
with that version on the same machine.

Following script reproduces the problem for me
any time:

<?php
	class l {
		function get() {
		}
	}

	class s {
		var $l;
		function s()  {
			$this->l = new l();
		}
	}

$s = new s();
echo "<h4>before</h4>\n";
print_r($s);
echo "<br>" . serialize($s);

$q = $s->l->get();

echo "<h4>after</h4>\n";
print_r($s);
echo "<br>" . serialize($s);
			
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-22 11:55 UTC] stas@php.net
Please try latest CVS, I guess it's fixed now.
 [2000-10-23 05:29 UTC] stas@php.net
User reports working now, closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 18:01:33 2024 UTC