|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64504 Forward reference of a class with interface
Submitted: 2013-03-24 15:56 UTC Modified: 2013-03-25 08:11 UTC
From: rstoll at tutteli dot ch Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.4.13 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
6 + 19 = ?
Subscribe to this entry?

 [2013-03-24 15:56 UTC] rstoll at tutteli dot ch
My PHP version is 5.4.7

forward references of classes do not work if the class implements an interface.

Test script:
$a = new Ok(); //that's ok

class OK{}

$a = new Fail(); //fails

interface I{}
class Fail implements I{}

Expected result:
I would expect that forward references are also supported for classes which implement an interface


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-03-25 06:36 UTC]
always declare before use(or use autoload mechanism)...

this is the current implementation, I don't think it's need to be fixed.
 [2013-03-25 08:10 UTC]
I concur.
 [2013-03-25 08:11 UTC]
-Status: Open +Status: Not a bug
 [2013-03-25 08:11 UTC]
Closing as not a bug, before it gets lost to time and becomes another number in a 
stack of non-bugs.
 [2013-03-25 10:42 UTC] rstoll at tutteli dot ch
And I thought PHP supports forward references. Well, well... learned something new.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Feb 22 15:01:29 2024 UTC