-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
While parent:: should inherit the called scope, it should only do so if it is compatible. If there is no called scope, or it is not a subtype of the scope, we should fall back to the scope.
- Loading branch information
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--TEST-- | ||
Bug #66719: Weird behaviour when using get_called_class() with call_user_func() | ||
--FILE-- | ||
<?php | ||
|
||
class A | ||
{ | ||
public static function who() | ||
{ | ||
var_dump(get_called_class()); | ||
} | ||
} | ||
class B extends A | ||
{ | ||
public static function who() | ||
{ | ||
parent::who(); | ||
} | ||
} | ||
|
||
class C | ||
{ | ||
public static function test() { | ||
B::who(); | ||
call_user_func(array(A::class, 'who')); | ||
call_user_func(array(B::class, 'parent::who')); | ||
} | ||
} | ||
|
||
B::who(); | ||
call_user_func(array(A::class, 'who')); | ||
call_user_func(array(B::class, 'parent::who')); | ||
|
||
C::test(); | ||
|
||
?> | ||
--EXPECT-- | ||
string(1) "B" | ||
string(1) "A" | ||
string(1) "A" | ||
string(1) "B" | ||
string(1) "A" | ||
string(1) "A" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters