Re: PHP 4.0 Bug #5152: Object passed in a session generates errors when member functions are called
| From: | Szii | Date: | Wed, 21 Jun 2000 02:27:18 +0000 |
| Subject: | Re: PHP 4.0 Bug #5152: Object passed in a session generates errors when member functions are called | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-21893@lists.php.net to get a copy of this message | ||
It is, unfortunately, a known problem.
As soon as I get a while I'm going to attempt a fix, but you're not the
only one running into it. It's a problem in the deserialize code, but
I've not recoded it yet - I'm still trying to learn all their macros. =P
-Szii
At 04:56 PM 6/20/00 -0000, jordan@eblox.com wrote:
>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.
>
>
>
>--
>PHP Development Mailing List <http://www.php.net/>
>To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
>For additional commands, e-mail: php-dev-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
>