Skip to content

Commit 396c1e9

Browse files
committed
Fixed bug #63468 (wrong called method as callback with inheritance)
1 parent d412152 commit 396c1e9

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ PHP NEWS
55
- Zend Engine:
66
. Fixed bug #63512 (parse_ini_file() with INI_SCANNER_RAW removes quotes
77
from value). (Pierrick)
8+
. Fixed bug #63468 (wrong called method as callback with inheritance).
9+
(Laruence)
810
- Core:
911
. Fixed bug #63451 (config.guess file does not have AIX 7 defined,
1012
shared objects are not created). (kemcline at au1 dot ibm dot com)

Zend/tests/bug63468.phpt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
Bug #63468 (wrong called method as callback with inheritance)
3+
--FILE--
4+
<?php
5+
class Foo
6+
{
7+
public function run()
8+
{
9+
return call_user_func(array('Bar', 'getValue'));
10+
}
11+
12+
private static function getValue()
13+
{
14+
return 'Foo';
15+
}
16+
}
17+
18+
class Bar extends Foo
19+
{
20+
public static function getValue()
21+
{
22+
return 'Bar';
23+
}
24+
}
25+
26+
$x = new Bar;
27+
var_dump($x->run());
28+
--EXPECT--
29+
string(3) "Bar"
30+

Zend/zend_API.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2520,7 +2520,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
25202520
} else if (zend_hash_find(ftable, lmname, mlen+1, (void**)&fcc->function_handler) == SUCCESS) {
25212521
retval = 1;
25222522
if ((fcc->function_handler->op_array.fn_flags & ZEND_ACC_CHANGED) &&
2523-
EG(scope) &&
2523+
!strict_class && EG(scope) &&
25242524
instanceof_function(fcc->function_handler->common.scope, EG(scope) TSRMLS_CC)) {
25252525
zend_function *priv_fbc;
25262526

0 commit comments

Comments
 (0)