php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6604 Restoration of object stored in session fails
Submitted: 2000-09-07 11:37 UTC Modified: 2000-10-16 11:13 UTC
From: balazs dot pataki at sztaki dot hu Assigned:
Status: Closed Package: Session related
PHP Version: 4.0.2 OS: SunOS 5.7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: balazs dot pataki at sztaki dot hu
New email:
PHP Version: OS:

 

 [2000-09-07 11:37 UTC] balazs dot pataki at sztaki dot hu
The following script causes an error, like:

Fatal error: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition test of the object you
are trying to operate on was loaded _before_ the session was started in /dsd2/www/htdocs/cow/test.php on line 12

The script:

<?
        class test { 
                var $x;
        }
        session_register ("sessVar");
        if ($sessVar == null) {
                $sessVar = new test();
                $sessVar->x = "foo";  
                echo "foo set. Reload!";  
        }
        else {
                echo $sessVar->x;
        }
?>

Here we tried to store a simple object in the session. The first time the script is invoked it creates a new test object and echos "foo set. Reload!". Then, reloading the script causes the error message shown above. Sessions with normal (not objects) variables work OK.

This script fails with 4.0.1pl2 as well.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-09-20 19:27 UTC] sas@php.net
Works for me. Do you have session.auto_start enabled? Or do you run prepend scripts which call session_start()/session_register()?
 [2000-10-16 11:13 UTC] sniper@php.net
No feedback. Can not reproduce.

--Jani
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 16:01:28 2024 UTC