Edit report at http://bugs.php.net/bug.php?id=54327&edit=1

 ID:                 54327
 User updated by:    j dot verloop at gmail dot com
 Reported by:        j dot verloop at gmail dot com
 Summary:            Interface extending problem
 Status:             Bogus
 Type:               Bug
 Package:            Scripting Engine problem
-Operating System:   OSX
+Operating System:   *
 PHP Version:        5.3.6
 Block user comment: N
 Private report:     N

 New Comment:

Changed to all platforms


Previous Comments:
------------------------------------------------------------------------
[2011-03-21 09:19:23] j dot verloop at gmail dot com

Thanks for your reply!

Btw, it´s not namespace related because I've found the same *problem*
without 

using namespaces.

You say it´s expected behaviour, so I suppose you´re right. But isn't
it weird 

the problem doesn't occur in the *same* inheritance structure when we
only use 

classes.



// Only classes

class A extends B {}



class C {}



class B extends C {}



everything is OK!

-----------------



// Classes and interfaces

class D implements E {}



interface F {}



interface E extends F {}



Fatal error: Interface 'E' not found in...

------------------------------------------



I've searched the documentation to clarify this issue as expected.

Obviously, I haven't found it. I would appreciate it if you could point
me in 

the right direction (documentation).

------------------------------------------------------------------------
[2011-03-21 02:45:05] [email protected]

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

This is expected, for such case you need to implement the interface
before using it.



<?php



namespace A\B;

interface z { }

interface C extends z {}



namespace A;

class B implements \A\B\C { }

------------------------------------------------------------------------
[2011-03-21 00:00:44] j dot verloop at gmail dot com

Description:
------------
PHP can't seem to find an interface when it's extended by another one
and 

implemented by a class located in a different namespace (when stored in
1 single 

file).

Test script:
---------------
I do have 3 examples:



Example 1:



test.php



namespace A;



class B implements \A\B\C, \Countable {

    public function count() {

        return 1;

    }

}



namespace A\B;



interface C {}



everything is OK!

-----------------



Example 2:



test.php



namespace A\B;



interface C extends \Countable {}



namespace A;



class B implements \A\B\C {

    public function count() {

        return 1;

    }

}



everything is OK!

-----------------



Example 3:



test.php



namespace A;



class B implements \A\B\C {

    public function count() {

        return 1;

    }

}



namespace A\B;



interface C extends \Countable {}



Fatal error

Expected result:
----------------
No fatal error ;)

Actual result:
--------------
Fatal error: Interface 'A\B\C' not found in...


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=54327&edit=1

Reply via email to