php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70685 Segfault for getClosure() internal method rebind with invalid $this
Submitted: 2015-10-10 12:43 UTC Modified: -
From: [email protected] Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.6.14 OS:
Private report: No CVE-ID: None
 [2015-10-10 12:43 UTC] [email protected]
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();


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-10-10 13:02 UTC] [email protected]
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Dec 31 04:00:01 2025 UTC