From: Nikita Popov Date: Wed, 30 Mar 2016 16:31:10 +0000 (+0200) Subject: Fix __invoke comparison in closure_get_method X-Git-Tag: php-7.0.6RC1~49^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f95679885ff9a7258f0a91b9d83d73a7ee7e6f91;p=php Fix __invoke comparison in closure_get_method It compared against the wrong variable. Fixed this by getting rid of lc_name entirely and use equals_literal_ci instead. --- diff --git a/Zend/tests/closure_invoke_case_insensitive.phpt b/Zend/tests/closure_invoke_case_insensitive.phpt new file mode 100644 index 0000000000..d41d58a747 --- /dev/null +++ b/Zend/tests/closure_invoke_case_insensitive.phpt @@ -0,0 +1,16 @@ +--TEST-- +Closure::__invoke() is case insensitive +--FILE-- +__INVOKE($n); +var_dump($n); + +?> +--EXPECT-- +int(2) diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 9b4fb1180e..def114c4ec 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -297,14 +297,10 @@ ZEND_API zval* zend_get_closure_this_ptr(zval *obj) /* {{{ */ static zend_function *zend_closure_get_method(zend_object **object, zend_string *method, const zval *key) /* {{{ */ { - zend_string *lc_name; - - lc_name = zend_string_tolower(method); - if (zend_string_equals_literal(method, ZEND_INVOKE_FUNC_NAME)) { - zend_string_release(lc_name); + if (zend_string_equals_literal_ci(method, ZEND_INVOKE_FUNC_NAME)) { return zend_get_closure_invoke_method(*object); } - zend_string_release(lc_name); + return std_object_handlers.get_method(object, method, key); } /* }}} */