Session problems with PHP 4.0.3pl1
| From: | O.J. Alcaraz | Date: | Thu, 26 Oct 2000 18:13:45 +0000 |
| Subject: | Session problems with PHP 4.0.3pl1 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-22182@lists.php.net to get a copy of this message | ||
Before we upgraded to 4.0.3pl1, our shopping cart application has been
running fine. Since upgrading to 4.0.3pl1, the application has not been
acting correctly. This has not only been the case on our development server
but also on the Web provider's server which also upgraded to 4.0.3pl1. We
did not change any of the code before migrating to 4.0.3pl1.
The problem occurs when a user would view the contents of his/her cart. I
would get an error message complaining that there was a "Call to a member
function on a non-object..."
We used a session variable to carry one instance of the object througout the
whole site feeling that it would be less messy as far as tracking data, etc.
So basically we have something like this when the user enters the site:
session_start();
session_register("session");
$session = array();
$session["object"] = new Object;
The rest of our pages has a session_start() in the beginning of the script
which would carry the one instance of the object to each page.
The line of code that the application errors on is calls a function. The
function has a global $session; to use the same $session var that has been
passed. Then we do a $session["object"]->member() and it breaks because
$session is not an object. I did an isset check in the function and it
yields false. I even tried putting the function in the class itself to no
avail. I'm very confused. I know this is very broad but I'm hoping that
maybe I missed something or the way I am attempting this is wrong. I can
email more details if that will make things clearer. Any help aprreciated.
-O.J. Alcaraz