Bug #70630 [Asn->Csd]: Closure::call/bind() crash with ReflectionFunction->getClosure()
| From: | bwoebi@php.net | Date: | Sat, 03 Oct 2015 23:43:51 +0000 |
| Subject: | Bug #70630 [Asn->Csd]: Closure::call/bind() crash with ReflectionFunction->getClosure() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-196375@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70630&edit=1
ID: 70630
Updated by: bwoebi@php.net
Reported by: bwoebi@php.net
Summary: Closure::call/bind() crash with
ReflectionFunction->getClosure()
-Status: Assigned
+Status: Closed
Type: Bug
Package: Reproducible crash
Operating System: *
PHP Version: master-Git-2015-10-03 (Git)
Assigned To: bwoebi
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=517b5536259ecf7697f353f4bfbafde857fc1f81
Log: Fixed bug #70630 (Closure::call/bind() crash with ReflectionFunction->getClosure()) This
additionally removes support for binding to an unknown (not in parent hierarchy) scope. Removing
support for cross-scope is necessary for certain compile-time assumptions (like class constants) to
prevent unexpected results
Previous Comments:
------------------------------------------------------------------------
[2015-10-03 22:55:52] bwoebi@php.net
Description:
------------
Closure::call() and Closure::bind() on functions (userland or internal) crash, when the functions
are raw functions without class/scope context.
Test script:
---------------
class a {}
$x = (new ReflectionFunction("substr"))->getClosure();
$x->call(new a);
// or
Closure::bind($x, new a, "a");
Expected result:
----------------
Warning: Cannot bind closure of a function to an object
Actual result:
--------------
Segmentation Fault
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70630&edit=1