diff --git a/Zend/tests/bug77339.phpt b/Zend/tests/bug77339.phpt new file mode 100644 index 00000000000..2e749bcd5a8 --- /dev/null +++ b/Zend/tests/bug77339.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #77339 (__callStatic may get incorrect arguments) +--FILE-- + +--EXPECT-- +OK diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 79968dac0d7..73cf0e75e33 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4055,6 +4055,14 @@ void zend_compile_static_call(znode *result, zend_ast *ast, uint32_t type) /* {{ if (ce) { zend_string *lcname = Z_STR_P(CT_CONSTANT(opline->op2) + 1); 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; + } + } } }