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

From: Date: Sun, 08 Aug 2010 15:06:26 +0000
Subject: Bug #52539 [Asn->Csd]: Calling function from rebound Closure causes crash
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-153244@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:             Assigned
+Status:             Closed
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Windows
 PHP Version:        trunk-SVN-2010-08-05 (SVN)
 Assigned To:        dmitry
 Block user comment: N

 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------
[2010-08-08 17:06:16] felipe@php.net

Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=301990
Log: - Fixed bug #52539 (Calling function from rebound Closure causes
crash)

------------------------------------------------------------------------
[2010-08-08 16:30:06] cataphract@php.net

The following patch has been added/updated:

Patch Name: patch_closures_rebind
Revision:   1281277806
URL:       
http://bugs.php.net/patch-display.php?bug=52539&patch=patch_closures_rebind&revision=1281277806

------------------------------------------------------------------------
[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 (#153244) next »