ID: 31525 User updated by: yml at yml 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:
Unfortunately the shortened script works as it should if you declare getThis to return a reference as in function &getThis() If however, you refer to the "too-long" script I put together at: http://www.formvista.com/uploaded_files/php5_drops_object.php.txt There is something different about it that causes $this to get dropped even when the method is declared return-by-reference. I haven't been able to narrow it down but it's entirely possible I'm overlooking something obvious. It's got to be something related to legacy pass by reference notation =&. The strange thing is it worked in 5.0.1 and broke in 5.0.2 or .3. Previous Comments: ------------------------------------------------------------------------ [2005-03-06 01:26:05] michaels at crye-leike dot com 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... ------------------------------------------------------------------------ [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] [EMAIL PROTECTED] 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] [EMAIL PROTECTED] Just a simple page with the script please, or paste it here. ------------------------------------------------------------------------ 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
