PHP 4.0 Bug #5152: Object passed in a session generates errors when member functions are called

From: Date: Tue, 20 Jun 2000 16:56:38 +0000
Subject: PHP 4.0 Bug #5152: Object passed in a session generates errors when member functions are called
Groups: php.dev 
Request: Send a blank email to php-dev+get-21857@lists.php.net to get a copy of this message
From: jordan@eblox.com Operating system: Linux 2.2.14 PHP version: 4.0 Latest CVS (20/06/2000) PHP Bug Type: Scripting Engine problem Bug description: Object passed in a session generates errors when member functions are called I've put three short pages that cause this problem for php 4.0.0. Seems that when an instance of a class is put into a session it becomes unable to access member functions of that instance (not the class, just that instance, as these scripts show), but it can still see variables. -------------classdec.php---------- <? // class declaration class TestClass { var $a; function heh($str) { echo $str . "<br>"; } } ?> ----------index.php---------- <? session_register("sessionvar"); Include("classdec.php"); // creating an instance of a class to pass as a session var to page.php $sessionvar = new TestClass; $sessionvar->a = "someval"; echo "<a href=page.php>link</a>"; ?> ----------page.php----------- <? session_register("sessionvar"); Include("classdec.php"); $anothervar = new TestClass; // I can use the variables of this instance that was created on index.php and put in a session echo $sessionvar->a . "<br>"; // I can call this function on another instance of the same class that I created on this page $anothervar->heh("this is output from the same function that generates an error on the next line"); // .....crash telling me it's an undefined function. $sessionvar->heh("rhewswh"); ?> ======================================================= produces following output on page.php after following the link from index.php: someval this is output from the same function that generates an error on the next line Fatal error: Call to undefined function: heh() in <path>/page.php on line 12 ============== any comments would be appreciated.

« previous php.dev (#21857) next »