PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #39758 Error message on extending a class that implements a interface
Submitted:6 Dec 2006 4:31pm UTC Modified: 25 Dec 2006 2:35pm UTC
From:bacher at bash-it dot de Assigned to:dmitry
Status:Wont fix Category:Class/Object related
Version:5.2.0 OS:Linux Ubuntu 6.0
Votes:4 Avg. Score:3.0 ± 0.0 Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%) Same OS:0 (0.0%)
View/Vote Developer Edit Submission

Welcome! If you don't have a SVN account, you can't do anything here. You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
SVN Username: SVN Password:
Quick Fix:
Status: Assign to:
Category:
Summary:
From: bacher at bash-it dot de
New email:
Version: OS:
New/Additional Comment:

[6 Dec 2006 4:31pm UTC] bacher at bash-it dot de
Description:
------------
If one tries to extend a class that implements a Interface, php5
produces a error message:
Fatal error: Class 'Bar' not found in foo.php on line xxxxx

I use the CLI Version of php.
PHP 5.1.2 (cli) (built: Nov  2 2006 12:29:42)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

Reproduce code:
---------------
<?php   
        class Bar extends Foo {
        }
        interface i {
        }
        class Foo implements i {
        }
?>

Expected result:
----------------
started on the commandline with the command:
php5 foo.php it should return simply nothing. But it throws an error.
if you just extend the class after you defined it it does not throw the
error:
<?php   
        interface i {
        }
        class Foo implements i {
        }
        class Bar extends Foo {
        }
?> 
Since this behaviour is not reproducable with a missing Interface, i
think this is a Error on Interfaces.

Actual result:
--------------
The error message 
Fatal error: Class 'Bar' not found in foo.php on line xxxxx
[6 Dec 2006 4:34pm UTC] bacher at bash-it dot de
Sorry, just while reading. The error Message is not:
Fatal error: Class 'Bar' not found in foo.php on line xxxxx

but 
Fatal error: Class 'Foo' not found in foo.php on line xxxxx

sorry for that. i hope you can reproduce it.
[25 Dec 2006 2:35pm UTC] dmitry@php.net
This is not a bug.
PHP always declares classes those implement interfaces at run-time. So
in your example you cannot declare "Bar" because "Foo" is not declared
yet.
Your report may be categorised as "feature request", but it cannot be
fixed in 5.2.* anyway, because of binary compatibility.

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC