note 60926 added to ref.session
| From: | pascal dot fr=gmail dot com at osu1 dot php dot net | Date: | Fri, 20 Jan 2006 10:24:24 +0000 |
| Subject: | note 60926 added to ref.session | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-102152@lists.php.net to get a copy of this message | ||
If you have saved an object in session, you must define the class of the object before the
session_start().
If you don't do that, php will not know the class of the object, and his type will be
"__PHP_Incomplete_Class".
This:
<?php
session_start();
class Foo{
var $fooVar = 'Hello world !!!';
}
$myFoo = new Foo();
$_SESSION['myFoo'] = $myFoo;
echo 'Save in session';
?>
define the Foo class and save an instance in session.
<?php
session_start();
echo '<pre>';
print_r( $_SESSION ); // don't know the Foo class...
echo '</pre>';
?>
will print :
Array
(
[myFoo] => __PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] => foo
[fooVar] => Hello world !!!
)
)
----
Server IP: 194.246.101.61
Probable Submitter: 129.185.75.9 (proxied: 129.182.137.236)
----
Manual Page -- http://www.php.net/manual/en/ref.session.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60926
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60926&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60926&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60926&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60926&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60926&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60926&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60926&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60926&report=yes
Search -- http://master.php.net/manage/user-notes.php