php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7291 Session drop objects in 4.0.3, it works OK in 4.0.2
Submitted: 2000-10-17 14:37 UTC Modified: 2000-10-18 14:33 UTC
From: david at boe dot es Assigned:
Status: Closed Package: Session related
PHP Version: 4.0.3pl1 OS: AIX 4.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
36 - 26 = ?
Subscribe to this entry?

 
 [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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-17 15:29 UTC] david at boe dot es
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?



 [2000-10-18 14:33 UTC] sas@php.net
Fixed in CVS.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 14 22:01:31 2024 UTC