Edit report at http://bugs.php.net/bug.php?id=52539&edit=1

 ID:                 52539
 Patch added by:     cataphr...@php.net
 Reported by:        cataphr...@php.net
 Summary:            Calling function from rebound Closure causes crash
 Status:             Assigned
 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:

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


Previous Comments:
------------------------------------------------------------------------
[2010-08-05 09:34:56] cataphr...@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

Reply via email to