|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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:
<?
error_reporting(15);
session_start();
session_register("SESSION");
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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 11:00:01 2025 UTC |
please make the class definition always available to your script! in you case "class object" is only available is $SESSION is not set! moving: class object{}; before the if statement will solve yor problem