Bug #70685 [Opn->Csd]: Segfault for getClosure() internal method rebind with invalid $this
| From: | nikic@php.net | Date: | Sat, 10 Oct 2015 13:02:24 +0000 |
| Subject: | Bug #70685 [Opn->Csd]: Segfault for getClosure() internal method rebind with invalid $this | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-196512@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70685&edit=1
ID: 70685
Updated by: nikic@php.net
Reported by: nikic@php.net
Summary: Segfault for getClosure() internal method rebind
with invalid $this
-Status: Open
+Status: Closed
Type: Bug
Package: Scripting Engine problem
PHP Version: 5.6.14
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d7d01fc9a326fe530df4e067db1df9ec451f4411
Log: Fixed bug #70685
Previous Comments:
------------------------------------------------------------------------
[2015-10-10 12:43:30] nikic@php.net
Description:
------------
So zend_create_closure correctly detects that this is wrong ... and then just goes on to bind NULL
for $this, which is a lot worse.
This has been fixed for PHP 7.0 as a side-effect of https://github.com/php/php-src/commit/4b821f0fc6aade0eb9793a8b4fa3cd28b347ac2f,
but needs to be fixed for PHP 5.6 as well.
Test script:
---------------
<?php
class cls {}
$c = (new ReflectionMethod('SplStack', 'count'))->getClosure(new SplStack);
$c = $c->bindTo(new cls);
$c();
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70685&edit=1