|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-10-17 14:37 UTC] david at boe dot es
The session funtionality drops any object type variables when accesed in the page. If the page doesn't access the object var, it doesn't deletes the object from the session file. This behaviour began in 4.0.3 and is maintained in 4.0.3pl1. Reverting to 4.0.2 solves the problem. I can't post the code, because it's too long, but I can work in a little script that reproduce the problem if you really need it. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 10 03:00:01 2026 UTC |
This script shows the behaviour: <? class Cart { var $items; /* array de articulos */ function Cart() { /* object constructor */ $this->init(); } function init() { /* inicializa y resetea la cesta */ $this->items = array(); } function add($productid, $qty) { /* aM-qade un articulo a la cesta aM-qadiendo el numero de unidades*/ if (isset($productid)) { if (! isset($this->items[$productid])) { $this->items[$productid]=0; } $this->items[$productid] += $qty; } } } session_start(); session_register("SESSION"); if (! isset($SESSION)) { $SESSION = array(); } if (! isset($SESSION["cesta"])) { // This is supposed to be executed echo "INITIALIZING CART<BR>\n"; // just 1 time in the session, $SESSION["cesta"] = new Cart; // isn't it? } $SESSION["cesta"]->add('cameras',1); // Add 1 to the 'cameras' item echo "Cameras: "; echo $SESSION["cesta"]->items['cameras']; echo "\n"; ?> When executed with PHP 4.0.2 it increments the counter for the 'cameras' item in the items array of the 'cesta' object. when executed with PHP 4.0.3 (or 4.0.3pl1), it always resets the counter and prints the "Initializing object" message. Thanks for your help, and congratulations for your work... BTW, any1 going to ApacheCON next week?