@@ -1674,19 +1674,17 @@ ZEND_API bool zend_check_protected(const zend_class_entry *ce, const zend_class_
16741674}
16751675/* }}} */
16761676
1677- ZEND_API zend_function * zend_get_call_trampoline_func (const zend_class_entry * ce , zend_string * method_name , bool is_static ) /* {{{ */
1677+ ZEND_API ZEND_ATTRIBUTE_NONNULL zend_function * zend_get_call_trampoline_func (
1678+ const zend_function * fbc , zend_string * method_name ) /* {{{ */
16781679{
16791680 size_t mname_len ;
16801681 zend_op_array * func ;
1681- zend_function * fbc = is_static ? ce -> __callstatic : ce -> __call ;
16821682 /* We use non-NULL value to avoid useless run_time_cache allocation.
16831683 * The low bit must be zero, to not be interpreted as a MAP_PTR offset.
16841684 */
16851685 static const void * dummy = (void * )(intptr_t )2 ;
16861686 static const zend_arg_info arg_info [1 ] = {{0 }};
16871687
1688- ZEND_ASSERT (fbc );
1689-
16901688 if (EXPECTED (EG (trampoline ).common .function_name == NULL )) {
16911689 func = & EG (trampoline ).op_array ;
16921690 } else {
@@ -1700,13 +1698,10 @@ ZEND_API zend_function *zend_get_call_trampoline_func(const zend_class_entry *ce
17001698 func -> fn_flags = ZEND_ACC_CALL_VIA_TRAMPOLINE
17011699 | ZEND_ACC_PUBLIC
17021700 | ZEND_ACC_VARIADIC
1703- | (fbc -> common .fn_flags & (ZEND_ACC_RETURN_REFERENCE |ZEND_ACC_ABSTRACT |ZEND_ACC_DEPRECATED |ZEND_ACC_NODISCARD ));
1701+ | (fbc -> common .fn_flags & (ZEND_ACC_RETURN_REFERENCE |ZEND_ACC_ABSTRACT |ZEND_ACC_DEPRECATED |ZEND_ACC_NODISCARD | ZEND_ACC_STATIC ));
17041702 func -> fn_flags2 = 0 ;
17051703 /* Attributes outlive the trampoline because they are created by the compiler. */
17061704 func -> attributes = fbc -> common .attributes ;
1707- if (is_static ) {
1708- func -> fn_flags |= ZEND_ACC_STATIC ;
1709- }
17101705 func -> opcodes = & EG (call_trampoline_op );
17111706 ZEND_MAP_PTR_INIT (func -> run_time_cache , (void * * )dummy );
17121707 func -> scope = fbc -> common .scope ;
@@ -1828,12 +1823,6 @@ ZEND_API zend_function *zend_get_property_hook_trampoline(
18281823 return func ;
18291824}
18301825
1831- static zend_always_inline zend_function * zend_get_user_call_function (zend_class_entry * ce , zend_string * method_name ) /* {{{ */
1832- {
1833- return zend_get_call_trampoline_func (ce , method_name , false);
1834- }
1835- /* }}} */
1836-
18371826ZEND_API ZEND_COLD zend_never_inline void zend_bad_method_call (const zend_function * fbc , const zend_string * method_name , const zend_class_entry * scope ) /* {{{ */
18381827{
18391828 zend_throw_error (NULL , "Call to %s method %s::%s() from %s%s" ,
@@ -1875,7 +1864,7 @@ ZEND_API zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *
18751864 ZSTR_ALLOCA_FREE (lc_method_name , use_heap );
18761865 }
18771866 if (zobj -> ce -> __call ) {
1878- return zend_get_user_call_function (zobj -> ce , method_name );
1867+ return zend_get_call_trampoline_func (zobj -> ce -> __call , method_name );
18791868 } else {
18801869 return NULL ;
18811870 }
@@ -1901,7 +1890,7 @@ ZEND_API zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *
19011890 if (UNEXPECTED (fbc -> op_array .fn_flags & ZEND_ACC_PRIVATE )
19021891 || UNEXPECTED (!zend_check_protected (zend_get_function_root_class (fbc ), scope ))) {
19031892 if (zobj -> ce -> __call ) {
1904- fbc = zend_get_user_call_function (zobj -> ce , method_name );
1893+ fbc = zend_get_call_trampoline_func (zobj -> ce -> __call , method_name );
19051894 } else {
19061895 zend_bad_method_call (fbc , method_name , scope );
19071896 fbc = NULL ;
@@ -1922,14 +1911,8 @@ ZEND_API zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *
19221911}
19231912/* }}} */
19241913
1925- static zend_always_inline zend_function * zend_get_user_callstatic_function (zend_class_entry * ce , zend_string * method_name ) /* {{{ */
1926- {
1927- return zend_get_call_trampoline_func (ce , method_name , true);
1928- }
1929- /* }}} */
1930-
19311914static zend_always_inline zend_function * get_static_method_fallback (
1932- zend_class_entry * ce , zend_string * function_name )
1915+ const zend_class_entry * ce , zend_string * function_name )
19331916{
19341917 zend_object * object ;
19351918 if (ce -> __call &&
@@ -1939,9 +1922,9 @@ static zend_always_inline zend_function *get_static_method_fallback(
19391922 * see: tests/classes/__call_004.phpt */
19401923
19411924 ZEND_ASSERT (object -> ce -> __call );
1942- return zend_get_user_call_function (object -> ce , function_name );
1925+ return zend_get_call_trampoline_func (object -> ce -> __call , function_name );
19431926 } else if (ce -> __callstatic ) {
1944- return zend_get_user_callstatic_function (ce , function_name );
1927+ return zend_get_call_trampoline_func (ce -> __callstatic , function_name );
19451928 } else {
19461929 return NULL ;
19471930 }
0 commit comments