Skip to content

Commit dbb9867

Browse files
committed
Avoid useless checks for public functions
1 parent e4be6ce commit dbb9867

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Zend/zend_object_handlers.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,13 +1273,12 @@ ZEND_API zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *
12731273
fbc = NULL;
12741274
}
12751275
}
1276-
} else {
1276+
} else if (fbc->op_array.fn_flags & (ZEND_ACC_CHANGED|ZEND_ACC_PROTECTED)) {
12771277
/* Ensure that we haven't overridden a private function and end up calling
12781278
* the overriding public function...
12791279
*/
1280-
if (fbc->op_array.fn_flags & (ZEND_ACC_CHANGED|ZEND_ACC_PROTECTED)) {
1281-
scope = zend_get_executed_scope();
1282-
}
1280+
1281+
scope = zend_get_executed_scope();
12831282
if (fbc->op_array.fn_flags & ZEND_ACC_CHANGED) {
12841283
if (scope && is_derived_class(fbc->common.scope, scope)) {
12851284
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 *
12901289
}
12911290
}
12921291
}
1293-
}
1294-
if (fbc->common.fn_flags & ZEND_ACC_PROTECTED) {
1292+
} else {
12951293
/* Ensure that if we're calling a protected function, we're allowed to do so.
12961294
* If we're not and __call() handler exists, invoke it, otherwise error out.
12971295
*/

0 commit comments

Comments
 (0)