File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 8
8
- Standard:
9
9
. Fixed bug #81048 (phpinfo(INFO_VARIABLES) "Array to string conversion").
10
10
(cmb)
11
+ . Fixed bug #77627 (method_exists on Closure::__invoke inconsistency).
12
+ (krakjoe)
11
13
12
14
03 Jun 2021, PHP 8.0.7
13
15
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Fix for #77627 method_exists on Closure::__invoke without object returns false
3
+ --FILE--
4
+ <?php
5
+ var_dump (method_exists (Closure::class, "__invoke " ));
6
+ var_dump (method_exists (Closure::class, "__INVOKE " ));
7
+
8
+ $ closure = function (){};
9
+
10
+ var_dump (method_exists ($ closure , "__INVOKE " ));
11
+ ?>
12
+ --EXPECT--
13
+ bool(true)
14
+ bool(true)
15
+ bool(true)
Original file line number Diff line number Diff line change @@ -950,16 +950,22 @@ ZEND_FUNCTION(method_exists)
950
950
func = Z_OBJ_HT_P (klass )-> get_method (& obj , method_name , NULL );
951
951
if (func != NULL ) {
952
952
if (func -> common .fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE ) {
953
- /* Returns true to the fake Closure's __invoke */
953
+ /* Returns true for the fake Closure's __invoke */
954
954
RETVAL_BOOL (func -> common .scope == zend_ce_closure
955
- && zend_string_equals_literal (method_name , ZEND_INVOKE_FUNC_NAME ));
955
+ && zend_string_equals_literal_ci (method_name , ZEND_INVOKE_FUNC_NAME ));
956
956
957
957
zend_string_release_ex (func -> common .function_name , 0 );
958
958
zend_free_trampoline (func );
959
959
return ;
960
960
}
961
961
RETURN_TRUE ;
962
962
}
963
+ } else {
964
+ /* Returns true for fake Closure::__invoke */
965
+ if (ce == zend_ce_closure
966
+ && zend_string_equals_literal_ci (method_name , ZEND_INVOKE_FUNC_NAME )) {
967
+ RETURN_TRUE ;
968
+ }
963
969
}
964
970
RETURN_FALSE ;
965
971
}
You can’t perform that action at this time.
0 commit comments