PHP4 Bug #1817: crashes when trying to reference a class object saved via session_register

From: Date: Thu, 22 Jul 1999 01:41:56 +0000
Subject: PHP4 Bug #1817: crashes when trying to reference a class object saved via session_register
Groups: php.dev 
Request: Send a blank email to php-dev+get-8938@lists.php.net to get a copy of this message
From: john@trytel.com Operating system: Linux 2.3.5 PHP version: 4.0 Beta 1 PHP Bug Type: Reproduceable crash Bug description: crashes when trying to reference a class object saved via session_register Here is the error in /www/logs/error_log: [Wed Jul 21 21:27:03 1999] [notice] Apache/1.3.6 (Unix) PHP/4.0B1 AuthMySQL/2.20 configured -- resuming normal operations [Wed Jul 21 21:27:05 1999] [notice] child pid 349 exit signal Segmentation fault (11) Here is my test file: <? require "php4lib.php3"; if ( !isset($cart) ) { $cart = new Cart; $cart->debug = 1; $cart->init(); $cart->add_item("1011", "AMD K6-3 450mhz", "250.00"); $cart->save(); } else { echo "'".$cart->items[idx]."'"; } ?> This is php4lib.php3: <? class Cart { var $items; var $debug; function init() { session_start(); if ($this->debug) echo "CART: Session started, ID is '".session_id()."'\n"; } function save() { session_register("cart"); if ($this->debug) echo "CART: Saved.\n"; } function clear() { session_unregister("items"); session_destroy(); if ($this->debug) echo "CART: Items cleared, session destroyed.\n"; } function add_item($idx, $desc, $price=0.00, $quantity=1, $long_desc="") { $this->items[idx] = $idx; $this->items[desc] = $desc; $this->items[price] = $price; $this->items[quantity] = $quantity; $this->items[long_desc] = $long_desc; if ($this->debug) echo "CART: Item added, '$idx, $desc, $price, $quantity, $long_desc.\n"; } function remove_item($idx) { if ($this->debug) echo "CART: Item $idx removed.\n"; } function inc_quantity($idx, $amount) { if ($this->debug) echo "CART: Item $idx quantity increased by $amount.\n"; } function dec_quantity($idx, $amount) { if ($this->debug) echo "CART: Item $idx quantity decreases by $amount.\n"; } } ?>

« previous php.dev (#8938) next »