|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-05-06 10:33 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 06:00:02 2025 UTC |
Description: ------------ When trying to store class property values in $_SESSION the whole class is put into session. Reproduce code: --------------- for($i=0; $i <= $this->numItems;$i++){ $_SESSION['cart']['numItems'] = $this->numItems; $_SESSION['cart']['items'][$i]['isbn'] = $this->items[$i]['isbn']; $_SESSION['cart']['items'][$i]['quantity'] = $this->items[$i]['quantity']; } Expected result: ---------------- Array ( [numItems] => 1 [items] => Array ( [1] => Array ( [isbn] => BR15609 [quantity] => 1 ) ) ) Actual result: -------------- Array ( [cart] => shoppingcart Object ( [numItems] => 1 [items] => Array ( [1] => Array ( [isbn] => BR15609 [quantity] => 1 ) ) ) )