File tree Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ PHP NEWS
11
11
the method is private). (Nikita)
12
12
. Implemented FR #77372 (Relative file path is removed from uploaded file).
13
13
(Björn Tantau)
14
+
15
+ - Standard:
16
+ . Fixed bug #77627 (method_exists on Closure::__invoke inconsistency).
17
+ (krakjoe)
14
18
15
19
- Date:
16
20
. Fixed bug #52480 (Incorrect difference using DateInterval) (Derick)
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 @@ -923,16 +923,22 @@ ZEND_FUNCTION(method_exists)
923
923
func = Z_OBJ_HT_P (klass )-> get_method (& obj , method_name , NULL );
924
924
if (func != NULL ) {
925
925
if (func -> common .fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE ) {
926
- /* Returns true to the fake Closure's __invoke */
926
+ /* Returns true for the fake Closure's __invoke */
927
927
RETVAL_BOOL (func -> common .scope == zend_ce_closure
928
- && zend_string_equals_literal (method_name , ZEND_INVOKE_FUNC_NAME ));
928
+ && zend_string_equals_literal_ci (method_name , ZEND_INVOKE_FUNC_NAME ));
929
929
930
930
zend_string_release_ex (func -> common .function_name , 0 );
931
931
zend_free_trampoline (func );
932
932
return ;
933
933
}
934
934
RETURN_TRUE ;
935
935
}
936
+ } else {
937
+ /* Returns true for fake Closure::__invoke */
938
+ if (ce == zend_ce_closure
939
+ && zend_string_equals_literal_ci (method_name , ZEND_INVOKE_FUNC_NAME )) {
940
+ RETURN_TRUE ;
941
+ }
936
942
}
937
943
RETURN_FALSE ;
938
944
}
You can’t perform that action at this time.
0 commit comments