php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41302 Class properties in $_SESSION cause whole class to be included
Submitted: 2007-05-06 08:09 UTC Modified: 2007-05-06 10:33 UTC
From: gerard dot payne at nellies dot jp Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.4.7 OS: Red Hat
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gerard dot payne at nellies dot jp
New email:
PHP Version: OS:

 

 [2007-05-06 08:09 UTC] gerard dot payne at nellies dot jp
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
                        )

                )
        )
)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-06 10:33 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Dec 03 06:00:02 2025 UTC