com php-src: Avoid useless checks for public functions: Zend/zend_object_handlers.c

From: Date: Mon, 09 Jul 2018 14:30:14 +0000
Subject: com php-src: Avoid useless checks for public functions: Zend/zend_object_handlers.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-102496@lists.php.net to get a copy of this message
Commit: dbb9867b3ea9c0546e9eb8c88e9650b306e6b770 Author: Dmitry Stogov <dmitry@zend.com> Mon, 9 Jul 2018 17:30:14 +0300 Parents: e4be6ce0fa04a84ad69a07a6b11a0f8f0ec4df61 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=dbb9867b3ea9c0546e9eb8c88e9650b306e6b770 Log: Avoid useless checks for public functions Changed paths: M Zend/zend_object_handlers.c Diff: diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 72c182c..c5c7617 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -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. */

« previous php.cvs (#102496) next »