Bug #50027 [Csd]: $this becomes a non-object

From: Date: Thu, 08 Sep 2011 10:31:49 +0000
Subject: Bug #50027 [Csd]: $this becomes a non-object
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-163384@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=50027&edit=1

 ID:                 50027
 User updated by:    phpbugs at colin dot guthr dot ie
 Reported by:        phpbugs at colin dot guthr dot ie
 Summary:            $this becomes a non-object
 Status:             Closed
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Mandriva Linux (Cooker x86_64)
 PHP Version:        5.3.1RC2
 Assigned To:        dmitry
 Block user comment: N
 Private report:     N

 New Comment:

The revision was mentioned a few comments back: r303016

http://svn.php.net/viewvc?view=revision&revision=303016
http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3/Zend/zend_gc.c?r1=297307&r2=303016&pathrev=303016


According to the log:
http://svn.php.net/viewvc/php/php-src/tags/php_5_3_4/Zend/zend_gc.c?view=log

This was included in PHP 5.3.4.


Previous Comments:
------------------------------------------------------------------------
[2011-09-07 23:38:55] brian dot feaver at sellingsource dot com

Looking through the SVN log and the change log for releases since this was fixed, 
I can't find when this was released, nor the commit to SVN that fixed it.

What commit fixed it and what release was this fixed in?

------------------------------------------------------------------------
[2011-01-16 22:10:12] stas@php.net

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.



------------------------------------------------------------------------
[2010-11-16 11:10:35] phpbugs at colin dot guthr dot ie

So far so good! I updated to PHP 5.3.3 again and reproduced the error (and got four nice core
dumps), then applied the patch and tried to reproduce again and so far, I'm coreless.

Thanks for highlighting the patch. Just with this bug had lead to more investigations earlier as
I've had to jump through hoops to avoid updating to PHP 5.3.x because of this problem. Still
hopefully looking good now :)

------------------------------------------------------------------------
[2010-11-16 09:38:23] bsteinbrink at saltation dot de

We encountered this bug yesterday (we could reproduce it quite easily with our code, but
unfortunately we cannot disclose it), debugged it, found out that it was due to the GC corrupting
the std_object_handlers prototype and once we knew that, we checked with the svn repo and saw that
that was fixed in r303016.

The corruption that happens is that the read_property field of std_object_handlers gets set to NULL,
because the GC treated the handler as a zval.

The report from lukas about the failure to set a property seems like an independent bug, as a
different field got corrupted (and he had the gc turned off anyway).

------------------------------------------------------------------------
[2010-11-10 15:44:51] lukas at twobits dot cz

Bad news. Just got the same bug again, with PHP 5.3.3 and GC switched OFF. Again, only one Apache
process fails. The process begun failing immediately after Apache restart. A simple reproduce class:

Reproduce code:
---------------
class Test
{

        private $data = NULL;

        public function __construct($data)
        {
                echo "<pre>";
                var_dump($this);
                echo "</pre>";
                $this->data = $data;
        }

        public function getData()
        {
                echo "<pre>";
                var_dump($this);
                echo "</pre>";
                return $this->data;
        }
}

echo "PID: " . getmypid();

$foo = new Test('Hello');

echo $foo->getData();


Correct output:
---------------
PID: 22839
object(Test)#1 (1) {
  ["data":"Test":private]=>
  NULL
}
object(Test)#1 (1) {
  ["data":"Test":private]=>
  string(5) "Hello"
}
Hello

Malfunctioning Apache process output:
-------------------------------------
PID: 22818
object(Test)#1 (1) {
  ["data":"Test":private]=>
  NULL
}
Warning: Attempt to assign property of non-object in /var/www/html/testthis.php on line 16 
object(Test)#1 (1) {
  ["data":"Test":private]=>
  NULL
}

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=50027


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=50027&edit=1


Thread (19 messages)

« previous php.bugs (#163384) next »