Avoid useless checks for public functions

This commit is contained in:
Dmitry Stogov 2018-07-09 17:30:14 +03:00
parent e4be6ce0fa
commit dbb9867b3e

View file

@ -1273,13 +1273,12 @@ ZEND_API zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *
fbc = NULL;
}
}
} else {
} else if (fbc->op_array.fn_flags & (ZEND_ACC_CHANGED|ZEND_ACC_PROTECTED)) {
/* Ensure that we haven't overridden a private function and end up calling
* the overriding public function...
*/
if (fbc->op_array.fn_flags & (ZEND_ACC_CHANGED|ZEND_ACC_PROTECTED)) {
scope = zend_get_executed_scope();
}
scope = zend_get_executed_scope();
if (fbc->op_array.fn_flags & ZEND_ACC_CHANGED) {
if (scope && is_derived_class(fbc->common.scope, scope)) {
if ((func = zend_hash_find(&scope->function_table, lc_method_name)) != NULL) {
@ -1290,8 +1289,7 @@ ZEND_API zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *
}
}
}
}
if (fbc->common.fn_flags & ZEND_ACC_PROTECTED) {
} else {
/* Ensure that if we're calling a protected function, we're allowed to do so.
* If we're not and __call() handler exists, invoke it, otherwise error out.
*/