php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31313 $this reference is bad during __wakeup
Submitted: 2004-12-27 18:19 UTC Modified: 2005-04-07 01:00 UTC
From: bugs dot php dot net at future dot shiny dot co dot il Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 4CVS-2005-01-20 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bugs dot php dot net at future dot shiny dot co dot il
New email:
PHP Version: OS:

 

 [2004-12-27 18:19 UTC] bugs dot php dot net at future dot shiny dot co dot il
Description:
------------
This is a re-open of Bug #13968.

I can still see the same issue happening with PHP 4.3.10. Just like the previous poster (in bug #13968), I cannot reproduce this with simple code. However, the general idea is this:

class Base
{
   var $resource = new Resource();

   function __wakeup()
   {
       // In a saved session, the resource lost relevance, so we reopne it:
       $this->resource = open_resource(); // <-- this corrupts Thing's another_member
   }
};

class Child extends Base
{
};

class Thing
{
   var $member;
   var $another_member; // <-- when wakes up, this is equal to the Resource we open in Base's __wakeup.

   function Thing()
   {
      $this->member = new Child();
      $this->another_member = 12345;
   }
};


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-17 18:42 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

And if you can reproduce it, please come up with simple test case.

 [2005-01-20 14:50 UTC] bugs dot php dot net at future dot shiny dot co dot il
Yes, I can reproduce this with the latest snapshot.
No, despite all my attempts, I wasn't able to produce a minimized testcase.
Even if I take the session file and run it through unserialize in the same environment, I cannot reproduce this.
However, I *can* reliably reproduce this bug in my own environment.

From this, I realize that the only solution is for me to debug it myself. I serialize an object, which has a member object. If, during wakeup, I replace that member object (with assignment '=') with another variable of type Object (ANY variable, as long as its type Object), I'd be replacing some other unrelated member variable -- and the variable I'd be trying to replace will remain the same. Any hints at debugging this?
 [2005-04-07 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 10 10:01:27 2024 UTC