Segfault for getClosure() internal method rebind with invalid $this
[2015-10-10 12:43 UTC] 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();