|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-10-30 09:38 UTC] ori at chikki dot net
Session do not store objects! They are deleted and does not appear in the /tmp/sess_************ file associated with the session. This does not affect normal session variables. Downgrading to PHP4.0.2 solved the problem. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 17 07:00:01 2025 UTC |
Sample code as follows: ______________________________________________ // The Class class Count { var $counter; function add() { return $this->count++; } }// End class ______________________________________________ // The session // start up the sessions - use SESSION Array session_start(); session_register("SESSION"); /* initialise the Count objct if necessary */ if (!isset($SESSION["Count"])) { $SESSION["Count"] = new Count; } The problem is when trying to manipulate $SESSION["Count"]->add() - which does the required calculations, but does store the session for later use (the /tmp/sess_***** file).The entire script I used is long - here is a summary: <? class Counter { var $counter; function add() { return $this->counter++; } } session_start(); session_register("SESSION"); /* initialise the SESSION variable if necessary */ if (!isset($SESSION)) { $SESSION = array(); } /* initialise the Counter objct if necessary */ if (!isset($SESSION["Counter"])) { $SESSION["Counter"] = new Counter; } echo "Visits using normal variables: " . $SESSION["visit"]++; echo "<BR>"; echo "Visits using classes: " . $SESSION["counter"]->add; ?> Ori