mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-07 09:17:29 +00:00
Merge branch 'PHP-8.0'
* PHP-8.0: Fix #77627 method_exists on Closure::__invoke
This commit is contained in:
3 files changed
+27
-2
No files matched your search
@@ -11,6 +11,10 @@ PHP NEWS
|
||||
the method is private). (Nikita)
|
||||
. Implemented FR #77372 (Relative file path is removed from uploaded file).
|
||||
(Björn Tantau)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #77627 (method_exists on Closure::__invoke inconsistency).
|
||||
(krakjoe)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #52480 (Incorrect difference using DateInterval) (Derick)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Fix for #77627 method_exists on Closure::__invoke without object returns false
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(method_exists(Closure::class, "__invoke"));
|
||||
var_dump(method_exists(Closure::class, "__INVOKE"));
|
||||
|
||||
$closure = function(){};
|
||||
|
||||
var_dump(method_exists($closure, "__INVOKE"));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
@@ -923,9 +923,9 @@ ZEND_FUNCTION(method_exists)
|
||||
func = Z_OBJ_HT_P(klass)->get_method(&obj, method_name, NULL);
|
||||
if (func != NULL) {
|
||||
if (func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
|
||||
/* Returns true to the fake Closure's __invoke */
|
||||
/* Returns true for the fake Closure's __invoke */
|
||||
RETVAL_BOOL(func->common.scope == zend_ce_closure
|
||||
&& zend_string_equals_literal(method_name, ZEND_INVOKE_FUNC_NAME));
|
||||
&& zend_string_equals_literal_ci(method_name, ZEND_INVOKE_FUNC_NAME));
|
||||
|
||||
zend_string_release_ex(func->common.function_name, 0);
|
||||
zend_free_trampoline(func);
|
||||
@@ -933,6 +933,12 @@ ZEND_FUNCTION(method_exists)
|
||||
}
|
||||
RETURN_TRUE;
|
||||
}
|
||||
} else {
|
||||
/* Returns true for fake Closure::__invoke */
|
||||
if (ce == zend_ce_closure
|
||||
&& zend_string_equals_literal_ci(method_name, ZEND_INVOKE_FUNC_NAME)) {
|
||||
RETURN_TRUE;
|
||||
}
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user