Re: superglobal var names can't access object methods?

From: Date: Tue, 16 Apr 2002 20:08:50 +0000
Subject: Re: superglobal var names can't access object methods?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-93250@lists.php.net to get a copy of this message
I may be wrong on this one, and someone please correct me if I am, but I believe you can't store objects in a session variable. That might be the problem. -- Uchendu Nwachukwu newsreply AT unndunn DOT com - www.unndunn.com "Erik Price" <pricee@hhbrown.com> wrote in message news:83AFE237-5170-11D6-9B4E-0050E4857868@hhbrown.com... > I am getting the following error message: > > Fatal error: Call to undefined function: add_folderfile() in > /home/eprice/public_html/filerequest.php on line 756 > > I have the following code, line 756 is the line with the "if" test: > > // add the $ff_instance to the Print Request Folder using method > add_folderfile() > if (!$_SESSION['prfolder']->add_folderfile(serialize($ff_instance))) { > die("Could not store \$ff_instance object in \$_SESSION['prfolder'] > object"); > } > > The add_folderfile() method of the $_SESSION['prfolder'] object looks > like this: > > // add a folderfile to the Print Request Folder > function add_folderfile($ff_obj) > { > $this->prf_folder[] = $ff_obj; > return true; > } > > And I have properly defined the class variable $this->prf_folder as an > array at the top of the class in the following fasion: > > var $prf_folder = array(); > > The add_folderfile() function is defined as part of a class in an > includefile called "classes.inc", which I know is being correctly > included because every page on my site is built with a template class in > that same file. > > > Now that you've heard my life story... > > Does anyone know of any reasons why I might be getting the "undefined > function" error? Am I unable to use a superglobal > ($_SESSION['prfolder']) as the name of an object when attempting to use > a method of that object (as in the code at the top of this email)? > > > TIA, > > Erik > > > > ---- > > Erik Price > Web Developer Temp > Media Lab, H.H. Brown > pricee@hhbrown.com >

« previous php.general (#93250) next »