|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-11-10 08:11 UTC] derick@php.net
[2004-11-10 09:42 UTC] vrana@php.net
[2004-11-10 22:34 UTC] helly@php.net
[2004-11-10 23:24 UTC] chris at experiencetours dot com dot au
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 00:00:01 2025 UTC |
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