]> granicus.if.org Git - php/commitdiff
Simplify __call fetching for static methods
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 21 Jan 2020 16:04:24 +0000 (17:04 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 21 Jan 2020 16:04:24 +0000 (17:04 +0100)
If we have a __call on a parent, we should always also have a
__call on the child, so there's no need to perform this walk.

Zend/zend_object_handlers.c

index 668a1ef9d335ce8989e82bc06f922443c4733ce9..57529afa3fc289f50bd7adfc313622a7e3bae6ca 100644 (file)
@@ -1379,12 +1379,8 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
                                /* Call the top-level defined __call().
                                 * see: tests/classes/__call_004.phpt  */
 
-                               zend_class_entry *call_ce = object->ce;
-
-                               while (!call_ce->__call) {
-                                       call_ce = call_ce->parent;
-                               }
-                               return zend_get_user_call_function(call_ce, function_name);
+                               ZEND_ASSERT(object->ce->__call);
+                               return zend_get_user_call_function(object->ce, function_name);
                        } else if (ce->__callstatic) {
                                return zend_get_user_callstatic_function(ce, function_name);
                        } else {