Bug #52539 [Opn->Asn]: Calling function from rebound Closure causes crash

From: Date: Fri, 06 Aug 2010 01:53:26 +0000
Subject: Bug #52539 [Opn->Asn]: Calling function from rebound Closure causes crash
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-153137@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52539&edit=1

 ID:                 52539
 Updated by:         felipe@php.net
 Reported by:        cataphract@php.net
 Summary:            Calling function from rebound Closure causes crash
-Status:             Open
+Status:             Assigned
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Windows
 PHP Version:        trunk-SVN-2010-08-05 (SVN)
-Assigned To:        
+Assigned To:        dmitry
 Block user comment: N



Previous Comments:
------------------------------------------------------------------------
[2010-08-05 09:34:56] cataphract@php.net

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 this bug report at http://bugs.php.net/bug.php?id=52539&edit=1


Thread (4 messages)

« previous php.bugs (#153137) next »