#30741 [Bgs]: Interfaces must appear before use
| From: | chris at experiencetours dot com dot au | Date: | Wed, 10 Nov 2004 22:24:15 +0000 |
| Subject: | #30741 [Bgs]: Interfaces must appear before use | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969364997@lists.php.net to get a copy of this message | ||
ID: 30741
User updated by: chris at experiencetours dot com dot au
Reported By: chris at experiencetours dot com dot au
Status: Bogus
Bug Type: Documentation problem
Operating System: Linux
PHP Version: 5.0.2
New Comment:
Thank you for the quick response and pointers. I have now read the
migration guide and it does appear there. You may want to mention it
in the manual since this is what I used as a reference, but I guess it
is common sense to have to define the class and interfaces before
referenceing them.
Previous Comments:
------------------------------------------------------------------------
[2004-11-10 22:34:24] helly@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
We decided on this behavior....
------------------------------------------------------------------------
[2004-11-10 09:42:53] vrana@php.net
It is written at
http://www.php.net/manual/en/migration5.incompatible.php
:
"In some cases classes must be declared before used. It only happens
only if some of the new features of PHP 5 are used. Otherwise the
behaviour is the old."
Thus I think this bug can be marked as bogus.
------------------------------------------------------------------------
[2004-11-10 08:11:32] derick@php.net
This is expected behavior, but should be mentioned in PHP 5's migration
guide (http://de.php.net/manual/en/migration5.oop.php)
------------------------------------------------------------------------
[2004-11-10 01:43:26] chris at experiencetours dot com dot au
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 this bug report at http://bugs.php.net/?id=30741&edit=1