@@ -4100,51 +4100,15 @@ ZEND_API zend_string *zend_get_callable_name_ex(const zval *callable, const zend
41004100}
41014101/* }}} */
41024102
4103- static bool zend_fcc_function_handler_equals (const zend_function * func1 , const zend_function * func2 ) /* {{{ */
4103+ ZEND_API bool zend_fcc_closure_equals_ex (const zend_fcall_info_cache * a , const zend_fcall_info_cache * b )
41044104{
4105- if (func1 == func2 ) {
4106- return true;
4107- }
4108-
4109- const bool fake_closure1 = (func1 -> common .fn_flags & ZEND_ACC_FAKE_CLOSURE ) != 0 ;
4110- const bool fake_closure2 = (func2 -> common .fn_flags & ZEND_ACC_FAKE_CLOSURE ) != 0 ;
4111-
4112- if (!fake_closure1 && !fake_closure2 ) {
4113- return false;
4114- }
4115- if (((func1 -> common .fn_flags & ZEND_ACC_CLOSURE ) && !fake_closure1 ) ||
4116- ((func2 -> common .fn_flags & ZEND_ACC_CLOSURE ) && !fake_closure2 )) {
4117- return false;
4118- }
4119- if (func1 -> type != func2 -> type ||
4120- func1 -> common .scope != func2 -> common .scope ||
4121- !zend_string_equals (func1 -> common .function_name , func2 -> common .function_name )) {
4122- return false;
4123- }
4124-
4125- if (func1 -> type == ZEND_USER_FUNCTION ) {
4126- return func1 -> op_array .opcodes == func2 -> op_array .opcodes ;
4127- }
4128-
4129- return func1 -> internal_function .handler == func2 -> internal_function .handler ;
4130- }
4131- /* }}} */
4132-
4133- ZEND_API bool zend_fcc_closure_equals_ex (const zend_fcall_info_cache * a , const zend_fcall_info_cache * b ) /* {{{ */
4134- {
4135- const zend_function * func1 = a -> function_handler ;
4136- const zend_function * func2 = b -> function_handler ;
4105+ const zend_function * fn_a = a -> function_handler ;
4106+ const zend_object * closure_zobj_a = a -> closure && a -> closure -> ce == zend_ce_closure ? a -> closure : NULL ;
4107+ const zend_function * fn_b = b -> function_handler ;
4108+ const zend_object * closure_zobj_b = b -> closure && b -> closure -> ce == zend_ce_closure ? b -> closure : NULL ;
41374109
4138- if (a -> closure && a -> closure -> ce == zend_ce_closure ) {
4139- func1 = zend_get_closure_method_def (a -> closure );
4140- }
4141- if (b -> closure && b -> closure -> ce == zend_ce_closure ) {
4142- func2 = zend_get_closure_method_def (b -> closure );
4143- }
4144-
4145- return zend_fcc_function_handler_equals (func1 , func2 );
4110+ return zend_fn_closure_equals_ex (fn_a , closure_zobj_a , fn_b , closure_zobj_b );
41464111}
4147- /* }}} */
41484112
41494113ZEND_API bool zend_is_callable_at_frame (
41504114 const zval * callable , zend_object * object , const zend_execute_data * frame ,
0 commit comments