php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7844 object inside a session registered object is not restored correctly
Submitted: 2000-11-16 10:52 UTC Modified: 2000-11-17 12:34 UTC
From: mhaertl at weiden dot de Assigned:
Status: Closed Package: Session related
PHP Version: 4.0.3pl1 OS: Linux
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: mhaertl at weiden dot de
New email:
PHP Version: OS:

 

 [2000-11-16 10:52 UTC] mhaertl at weiden dot de
Since i updated to php-4.0.3pl1 from 4.0.1pl2 registering objects doesn't work correctly for me.

What i do is the following:

- create a object "a" from a class "myclass"
- in the constructor myclass() i create a new object "x" $this->x from class "innerclass"
- when i register my object "a" and restore it, i get an error when i try to call a method of $this->x
in object "a"

Here an Example. This works in php-4.0.1pl2 but not in php-4.0.3pl1 (You get an error when pressing reload link)

filename: index.php

<?php
class myclass  {
  function myclass() {
    $this->x = new innerobject;
  }
  function show() {
    $this->x->go();
  }
}

class innerobject {
  function go() {
    print "I'm in go() now!<br>";
  }
}

session_register("a");

if (! is_object($a) ) {
   $a = new myclass;
}

$a->show();

?>
<br>
<a href="index.php">reload</a>
?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-17 12:34 UTC] sniper@php.net
Fixed in CVs.

--Jani
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 10:01:33 2025 UTC