#20242 [Com]: Method call infront of class definition

From: Date: Sat, 15 Feb 2003 15:43:26 +0000
Subject: #20242 [Com]: Method call infront of class definition
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-33231@lists.php.net to get a copy of this message
ID: 20242 Comment by: admin@trevorj.com Reported By: marcus.boerger@post.rwth-aachen.de Status: Verified Bug Type: Zend Engine 2 problem PHP Version: 4CVS-2002-11-04 New Comment: yes this works with ZE1 completely, but still fails with ZE2... any news on this? sorry if this isnt the rite place... its just been awhile since the last comment. Previous Comments: ------------------------------------------------------------------------ [2002-11-04 10:59:34] iliaa@php.net This is indeed a ZE2 bug. It appears that unlike ZE1, ZE2 does not allow the class defenition to be made AFTER the calls to the class are made. This of course is not a good way to do things, class defenitions should occur before the class is being used. However, since this worked in ZE1, it probably should work in ZE2 as well. ------------------------------------------------------------------------ [2002-11-04 06:45:44] marcus.boerger@post.rwth-aachen.de Ups i rechecked it and now it works for ZE 1.3 maybe i missconfigured the test for ZE1. But it still fails for ZE2. I guess i should commit the test then. ------------------------------------------------------------------------ [2002-11-04 06:25:39] moriyoshi@php.net Huh? It just works for me. Hmm I'm rather interested in what causes it to fail in your environment. ------------------------------------------------------------------------ [2002-11-04 05:17:21] marcus.boerger@post.rwth-aachen.de While you can call functions in front or after current code you cannot do so with classes. As this is documented nowhere this is an error with both ZE1 and ZE2. Following .phpt file: ==================================== --TEST-- Method call infront of class definition --FILE-- <?php test::show_static(); $t = new test; $t->show_method(); class test { function show_static() { echo "static\n"; } function show_method() { echo "method\n"; } } ?> --EXPECT-- static method =EOF================================ Produces following .out ==================================== <font color=ff0000> Fatal error: Class 'test' not found in /usr/src/php4-HEAD/tests/classes/classes001.php on line 3 </font>/usr/src/php4-HEAD/tests/classes/classes001.php(3) : Fatal error - Class 'test' not found =EOF================================ ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20242&edit=1

« previous php.bugs (#33231) next »