mirror of
https://github.com/php/php-src.git
synced 2024-09-22 18:37:25 +00:00
Merge branch 'PHP-7.0'
* PHP-7.0: Fixed bug #71442 (forward_static_call crash)
This commit is contained in:
commit
506d5fe4df
@ -4839,7 +4839,7 @@ PHP_FUNCTION(forward_static_call)
|
||||
fci.retval = &retval;
|
||||
|
||||
called_scope = zend_get_called_scope(execute_data);
|
||||
if (called_scope &&
|
||||
if (called_scope && fci_cache.calling_scope &&
|
||||
instanceof_function(called_scope, fci_cache.calling_scope)) {
|
||||
fci_cache.called_scope = called_scope;
|
||||
}
|
||||
@ -4867,7 +4867,7 @@ PHP_FUNCTION(forward_static_call_array)
|
||||
fci.retval = &retval;
|
||||
|
||||
called_scope = zend_get_called_scope(execute_data);
|
||||
if (called_scope &&
|
||||
if (called_scope && fci_cache.calling_scope &&
|
||||
instanceof_function(called_scope, fci_cache.calling_scope)) {
|
||||
fci_cache.called_scope = called_scope;
|
||||
}
|
||||
|
37
ext/standard/tests/class_object/bug71442.phpt
Normal file
37
ext/standard/tests/class_object/bug71442.phpt
Normal file
@ -0,0 +1,37 @@
|
||||
--TEST--
|
||||
Bug #71442 (forward_static_call crash)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A
|
||||
{
|
||||
const NAME = 'A';
|
||||
public static function test() {
|
||||
$args = func_get_args();
|
||||
echo static::NAME, " ".join(',', $args)." \n";
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A
|
||||
{
|
||||
const NAME = 'B';
|
||||
|
||||
public static function test() {
|
||||
echo self::NAME, "\n";
|
||||
forward_static_call(array('A', 'test'), 'more', 'args');
|
||||
forward_static_call( 'test', 'other', 'args');
|
||||
}
|
||||
}
|
||||
|
||||
B::test('foo');
|
||||
|
||||
function test() {
|
||||
$args = func_get_args();
|
||||
echo "C ".join(',', $args)." \n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
B
|
||||
B more,args
|
||||
C other,args
|
Loading…
Reference in New Issue
Block a user