note 31542 rejected from language.oop.serialization by spic

From: Date: Fri, 25 Apr 2003 13:05:13 +0000
Subject: note 31542 rejected from language.oop.serialization by spic
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-47080@lists.php.net to get a copy of this message
i'm still having a problem retrieving an object stored in the session. on one page, i instantiate and store my shoppingCart object in the session. on another page i start the session and try to retrieve that object. it unserializes with mixed results: i can call the methods of the object, but the cart contains no items. to illustrate: ................PAGE 1................ // general.php includes a file that declares shoppingCart require ("includes/functions/general.php"); session_start(); if (!session_is_registered("cart")) { $cart = new shoppingCart; session_register("cart"); } // add/remove/modify items in cart // list items in cart // count items in cart // all working on each visit to page ................PAGE 2................ // general.php includes a file that declares shoppingCart require ("includes/functions/general.php"); session_start(); if (session_is_registered("cart")) { $products = $cart->get_products(); // always shows zero on this page and // the correct number on PAGE 1 echo "<script>alert('" . sizeof($products) . "')</script>"; }

« previous php.notes (#47080) next »