mirror of
https://github.com/php/php-src.git
synced 2024-12-25 01:40:50 +08:00
Merge branch 'PHP-7.3'
* PHP-7.3: Fixed bug #77339 (__callStatic may get incorrect arguments)
This commit is contained in:
commit
773ed62555
33
Zend/tests/bug77339.phpt
Normal file
33
Zend/tests/bug77339.phpt
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
--TEST--
|
||||||
|
Bug #77339 (__callStatic may get incorrect arguments)
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
class Foo
|
||||||
|
{
|
||||||
|
static function __callStatic($name, $arguments) {
|
||||||
|
if ($name === 'get') {
|
||||||
|
if (!isset($arguments[0])) {
|
||||||
|
var_dump(['getSomeWhat']);
|
||||||
|
var_dump($arguments);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "OK\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function get ($key) {
|
||||||
|
echo "BUG!!!\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Bar
|
||||||
|
{
|
||||||
|
static function __callStatic($name, $arguments) {
|
||||||
|
echo Foo::get('getSomeWhat');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Bar::someUndefinedStaticFunction();
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
OK
|
@ -4055,6 +4055,14 @@ void zend_compile_static_call(znode *result, zend_ast *ast, uint32_t type) /* {{
|
|||||||
if (ce) {
|
if (ce) {
|
||||||
zend_string *lcname = Z_STR_P(CT_CONSTANT(opline->op2) + 1);
|
zend_string *lcname = Z_STR_P(CT_CONSTANT(opline->op2) + 1);
|
||||||
fbc = zend_hash_find_ptr(&ce->function_table, lcname);
|
fbc = zend_hash_find_ptr(&ce->function_table, lcname);
|
||||||
|
if (fbc && !(fbc->common.fn_flags & ZEND_ACC_PUBLIC)) {
|
||||||
|
if (ce != CG(active_class_entry)
|
||||||
|
&&((fbc->common.fn_flags & ZEND_ACC_PRIVATE)
|
||||||
|
|| !zend_check_protected(zend_get_function_root_class(fbc), CG(active_class_entry)))) {
|
||||||
|
/* incompatibe function */
|
||||||
|
fbc = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user