From: cataphract
Operating system: Windows
PHP version: trunk-SVN-2010-08-05 (SVN)
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Calling function from rebound Closure causes crash
Description:
------------
Calling a function in a rebound closure causes a crash.
This seems to be caused by dmitry's optimizations because this fixes the
issue:
#define CACHED_PTR(num) 0.
Test script:
---------------
class foo {
static function getClosure() {
return static function () {
//causes a crash (fbc not properly defined) in call
after rebinding
echo get_called_class(), "\n";
};
}
}
class subFoo { }
$c = foo::getClosure();
$c(); //foo
$c = $c->bindTo(new subFoo());
$c(); //crash
Expected result:
----------------
No crash.
Actual result:
--------------
> php5ts_debug.dll!zend_do_fcall_common_helper_SPEC(_zend_execute_data *
execute_data=0x025d2298, void * * * tsrm_ls=0x02784bf8) Line 302 + 0x3
bytes C
php5ts_debug.dll!ZEND_DO_FCALL_SPEC_CONST_HANDLER(_zend_execute_data *
execute_data=0x025d2298, void * * * tsrm_ls=0x02784bf8) Line 1721 C
php5ts_debug.dll!execute(_zend_op_array * op_array=0x025f23c8, void * *
*
tsrm_ls=0x02784bf8) Line 136 + 0x11 bytes C
php5ts_debug.dll!zend_execute_scripts(int type=8, void * * *
tsrm_ls=0x02784bf8, _zval_struct * * retval=0x00000000, int file_count=3,
...) Line 1193 + 0x21 bytes C
php5ts_debug.dll!php_execute_script(_zend_file_handle *
primary_file=0x00aaf7b0, void * * * tsrm_ls=0x02784bf8) Line 2330 + 0x1b
bytes C
php.exe!main(int argc=2, char * * argv=0x02784af8) Line 1252 + 0x13
bytes C
--
Edit bug report at http://bugs.php.net/bug.php?id=52539&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52539&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52539&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=52539&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52539&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=52539&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52539&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=52539&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=52539&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=52539&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=52539&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=52539&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=52539&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=52539&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52539&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52539&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52539&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=52539&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=52539&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=52539&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=52539&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=52539&r=mysqlcfg