From: chris at experiencetours dot com dot au Operating system: Linux PHP version: 5.0.2 PHP Bug Type: Class/Object related Bug description: Interfaces must appear before use
Description: ------------ I am not sure if this is a bug or a documentation issue, but if an instance of a class is created before the Interface definition, the class will be undefined. Although this is not directly covered in the manual, it is inconsistent with functions, which can be reference before they are defined. ./configure --with-apache=/usr/local/src/apache/apache_1.3.31 --with-libxml-dir=/usr/local/libxml2 --enable-calendar --with-openssl=/usr --wi th-pear --with-zlib --enable-ftp --with-bz2 --with-ldap --with-pdflib --without-mysql --with-pgsql --with-pspell Reproduce code: --------------- $concreteType = new ConcreteType(); echo $concreteType->getText(); $c2 = new ContreteType2(); echo $c2->getText(); interface IType { public function getText(); } abstract class AbstractType implements IType { } class ConcreteType extends AbstractType { public function getText() { return "Hello World!!!"; } } class ConcreteType2 implements IType { public function getText() { return "Hello World!!!"; } } Expected result: ---------------- "Hello World!!!""Hello World!!!" Actual result: -------------- Fatal error: Class 'ConcreteType' not found in /usr/local/apache/htdocs/bookallot/test.php on line 1 -- Edit bug report at http://bugs.php.net/?id=30741&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30741&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30741&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30741&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30741&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30741&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30741&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30741&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30741&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30741&r=support Expected behavior: http://bugs.php.net/fix.php?id=30741&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30741&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30741&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30741&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30741&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30741&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30741&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30741&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30741&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30741&r=mysqlcfg