|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1999-07-26 17:17 UTC] zeev at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 18:00:02 2025 UTC |
(I sent this to the dev list before, but I haven't heard anything so I figured I'd better do the right thing and enter it in the bugs database) Ok, this one's a bit bizarre. PHP4 Beta 1, running as an apache module (1.3.6) on RH 6.0, compiled with imap support. Here's the test script: test.php3: <?php include 'class.inc'; require 'class2.inc'; $foo = new Bar2(); echo 'foo'; ?> class.inc: <?php class Bar { function Bar () { } } ?> class2.inc: <?php class Bar2 extends Bar { var $parent; function Bar2 () { $this->Bar(); } } ?> In php3, this works fine. In php4, I get: Fatal error: Class bar2: Cannot inherit from undefined class bar in class2.inc on line 7 If both classes are required, both included, *or* the first required and the second included, it works fine. It only happens when the include comes first. Is this unavoidable due to require() being evaluated before parsing the file? But that can't be completely true since you can use a variable as an argument to require()...?