#31525 [Com]: object reference being dropped. $this getting lost.

From: Date: Sun, 06 Mar 2005 00:26:06 +0000
Subject: #31525 [Com]: object reference being dropped. $this getting lost.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-74880@lists.php.net to get a copy of this message
ID: 31525 Comment by: michaels at crye-leike dot com Reported By: yml at yml dot com Status: Open Bug Type: Zend Engine 2 problem Operating System: * PHP Version: 5CVS-2005-03-03 New Comment: FWIW, here's a shorter script that reproduces the problem for me on PHP 5.0.3: <?php class Foo { function getThis() { return $this; } function destroyThis() { $baz =& $this->getThis(); } } $bar = new Foo(); $bar->destroyThis(); var_dump($bar); ?> This outputs: NULL If I change the assign-by-reference operator (=&) to the normal assignment operator (=) inside destroyThis(), I get: object(Foo)#1 (0) { } Hope this helps... Previous Comments: ------------------------------------------------------------------------ [2005-03-03 18:32:24] yml at yml dot com 1. Same problem. No improvement. $this is getting dropped. Used to work in 5.0RC2. Since 5.0.3 it's been broken. 2. The script I sent was puny. Given how terribly buggy the Zend engine is, expecting that all serious parser errors can be reproduced in a total of 20 lines or less is ridiculous. The meat of the script I sent clearly reproduces the problem in 8 lines, not including the supporting classes. You guys wouldn't pull it from my site; and now you won't look at it if I send it to you. Exactly what would you propose I do to help you track this down? The 85,000 lines of code that's actually having this problem (and producing a coredump), now that's a huge "script". ------------------------------------------------------------------------ [2005-02-28 21:10:16] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ..and NEVER ever attach such HUGE scripts in your report!!!! ------------------------------------------------------------------------ [2005-01-27 02:13:03] yml at yml dot com I forgot to mention, check the few lines at the very bottom of the code. Unfortunately the class definitions are required to reproduce the error but the basic script is extremely simple. Under PHP 5 you get a Warning: Attempt to assign property of non-object in /usr/local2/WWW/mobie.yml.com/mobie/admin_ui/tests/php_5_test/test.php on line 407 Under PHP 4 it runs through the 1000 iterations without fail. It's very simple code. This code used to run in PHP 5.0, but something changed in later versions to cause this error to crop up. ------------------------------------------------------------------------ [2005-01-26 09:08:22] derick@php.net Just a simple page with the script please, or paste it here. ------------------------------------------------------------------------ [2005-01-26 05:17:23] yml at yml dot com Umm. Check the script I put together for you at: http://www.yml.com/homepage.html?COMP=clog_list&cmd=detail&cs_clog_entries_ref=149 If you have trouble accessing it please let me know. ------------------------------------------------------------------------ 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 http://bugs.php.net/31525 -- Edit this bug report at http://bugs.php.net/?id=31525&edit=1

« previous php.bugs (#74880) next »