PHP 4.0 Bug #8105 Updated: session_register drops inner object

From: Date: Sat, 10 Mar 2001 01:55:36 +0000
Subject: PHP 4.0 Bug #8105 Updated: session_register drops inner object
Groups: php.dev 
Request: Send a blank email to php-dev+get-48514@lists.php.net to get a copy of this message
ID: 8105 Updated by: sniper Reported By: ronen@greyzone.com Old-Status: Feedback Status: Closed Bug Type: *Session related Assigned To: Comments: No feedback, not enough info, closed. --Jani Previous Comments: --------------------------------------------------------------------------- [2000-12-30 19:26:06] sniper@php.net Have you tried PHP 4.0.4? Does this work when using it? --Jani --------------------------------------------------------------------------- [2000-12-05 07:41:32] sniper@php.net Could you please try latest snapshot from http://snaps.php.net/ ?? --Jani --------------------------------------------------------------------------- [2000-12-04 17:19:40] ronen@greyzone.com When I have an object that I register to a session, it first describes the variable name, then the name of the class from which it was instantiated, and finally the property names and values for any of that objects properties. A problem exists when you try to register an object which has a different one nested within it. In this case, no mention of the inner object is registered, and the next time you attempt to call it, you get an error message of trying to call a method of a undeclared object. Ex: ===================================== file class.test.php <? class inner { function get_name($first_name,$last_name) { $return $first_name." ".$last_name; } } class outer extends inner { var fname; var lname; function outer ($fname,$lname) { $this->fname=$fname; $this->lname=$lname; } function x() { return $this->inner->get_name($this->fname,$this->lname); } } ?> ============================= file test1.html: <? require_once("class.test.php"); $testClass=new outer("jon","smith"); session_register("testClass"); ?> ============================= file test2.html: <? require_once("class.test.php"); session_start(); echo "FIRST_NAME: ".$testClass->fname."<br>"; echo "LAST_NAME: ".$testClass->lname."<br>"; echo "FULL_NAME: ".$testClass->x()."<br>"; ?> --------------------------------------------------------------------------- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=8105&edit=2

« previous php.dev (#48514) next »