|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4285 Unexpected warning using an object in a session
Submitted: 2000-05-01 04:13 UTC Modified: 2000-05-13 07:57 UTC
From: yzhang at sfu dot ca Assigned:
Status: Closed Package: Session related
PHP Version: 4.0 Release Candidate 1 OS: Linux (Redhat 6.0)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: yzhang at sfu dot ca
New email:
PHP Version: OS:


 [2000-05-01 04:13 UTC] yzhang at sfu dot ca
An unexpected warning comes back when I use an object in a session variable:

The code is this:


if (! isset($SESSION)) {
        class object {};
        $SESSION = new object;
        $SESSION->i = 5;
} else {
        echo "My value is: $SESSION->i";

Run it twice (first time to register the session, the second time to use it) and you will see this:

Warning: Unserializing non-existant class: stdClass! No methods will be available! in /home/httpd/htdocs/test.php on line 3
My value is: 5

Not sure why this is a warning, what is stdClass?  I find no mention of it in the manual.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-05-13 07:57 UTC] thies at cvs dot php dot net
please make the class definition always available to your script!

in you case "class object" is only available is $SESSION is not set!
class object{};
before the if statement will solve yor problem

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 22 20:01:29 2024 UTC