|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20242 Method call infront of class definition
Submitted: 2002-11-04 05:17 UTC Modified: 2003-02-15 09:49 UTC
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: marcus dot boerger at post dot rwth-aachen dot de Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 4CVS-2002-11-04 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: marcus dot boerger at post dot rwth-aachen dot de
New email:
PHP Version: OS:


 [2002-11-04 05:17 UTC] marcus dot boerger at post dot rwth-aachen dot 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:
Method call infront of class definition


$t = new test;

class test {
	function show_static() {
		echo "static\n";
	function show_method() {
		echo "method\n";

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-04 06:25 UTC]
Huh? It just works for me.
Hmm I'm rather interested in what causes it to fail in your environment.

 [2002-11-04 06:45 UTC] marcus dot boerger at post dot rwth-aachen dot 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 10:59 UTC]
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.
 [2003-02-15 09:43 UTC] admin at trevorj dot com
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.
 [2003-02-15 09:49 UTC]
I'll make it a no fix since the last discussions with 
Zeev and Andi suggest so.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Nov 26 16:05:52 2022 UTC