#39567 [NEW]: Cannot find Class definition when there is one

From: Date: Tue, 21 Nov 2006 09:55:38 +0000
Subject: #39567 [NEW]: Cannot find Class definition when there is one
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-105239@lists.php.net to get a copy of this message
From: imkow at 163 dot com Operating system: WinXp sp2+Apache2.2+Mod_PHP PHP version: 5.2.0 PHP Bug Type: Class/Object related Bug description: Cannot find Class definition when there is one Description: ------------ Two files: file1.php: class A{} file2.phpF require("file1.php"); $obj=new B; class B extends A{} when runing file2.php, it throws a Fatal Error, saying Class B can't be found in the line where "$obj=new B;" is. But, in following code, things will just be fine: class A{} $obj=new B; class B extends A{} I use an official release of PHP 5.2.0 under windows. All mods are also from Pecl. Reproduce code: --------------- //file1.php: class A{} //file2.phpF require("file1.php"); $obj=new B; class B extends A{} Expected result: ---------------- nothing.. Actual result: -------------- ( ! ) Fatal error: Class 'B' not found in file2.php on line 2 -- Edit bug report at http://bugs.php.net/?id=39567&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39567&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39567&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39567&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39567&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39567&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39567&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39567&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39567&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39567&r=support Expected behavior: http://bugs.php.net/fix.php?id=39567&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39567&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39567&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39567&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39567&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39567&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39567&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39567&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39567&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39567&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39567&r=mysqlcfg

« previous php.bugs (#105239) next »