Bug #70630 [NEW]: Closure::call/bind() crash with ReflectionFunction->getClosure()

From: Date: Sat, 03 Oct 2015 22:55:53 +0000
Subject: Bug #70630 [NEW]: Closure::call/bind() crash with ReflectionFunction->getClosure()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196373@lists.php.net to get a copy of this message
From:             bwoebi
Operating system: *
PHP version:      master-Git-2015-10-03 (Git)
Package:          Reproducible crash
Bug Type:         Bug
Bug description:Closure::call/bind() crash with ReflectionFunction->getClosure()

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 bug report at https://bugs.php.net/bug.php?id=70630&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=70630&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=70630&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=70630&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=70630&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=70630&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=70630&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=70630&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=70630&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=70630&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=70630&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=70630&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=70630&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=70630&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70630&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=70630&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=70630&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=70630&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70630&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=70630&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=70630&r=mysqlcfg



Thread (4 messages)

« previous php.bugs (#196373) next »