|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67128 class_alias is broken with abstract classes
Submitted: 2014-04-24 13:50 UTC Modified: 2016-04-16 13:47 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: mail at adrianlang dot de Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.5.11 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git 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.
Block user comment
Status: Assign to:
Bug Type:
From: mail at adrianlang dot de
New email:
PHP Version: OS:


 [2014-04-24 13:50 UTC] mail at adrianlang dot de
While verifying the signature of a class against the signature of an abstract class it extends, apparently class aliases are not correctly taken into account. This works if the class implements an interface or extends a non-abstract class.

See also

Test script:
class A {}

class_alias( 'A', 'B' );

abstract class UserOfA {
  abstract public function someMethod( B $a );

class ActualUserOfA extends UserOfA {
  public function someMethod( A $a ) {

Actual result:
PHP Fatal error:  Declaration of ActualUserOfA::someMethod() must be compatible with UserOfA::someMethod(B $a)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-16 13:47 UTC]
-Status: Open +Status: Not a bug
 [2016-04-16 13:47 UTC]
The issue here is that the classes are early-bound, so the alias does not exist at the point in time when the method signatures are verified. You can fix this by defining the classes in a different file or forcing late binding.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Sep 29 21:01:25 2023 UTC