Edit report at https://bugs.php.net/bug.php?id=62991&edit=1
ID: 62991
Updated by: dmitry@php.net
Reported by: softwareelves at gmail dot com
Summary: Segfault with generator and closure.
Status: Assigned
Type: Bug
Package: Reproducible crash
Operating System: Mac OSx 10.8.1
PHP Version: master-Git-2012-09-02 (Git)
Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
I've added a much simpler patch. Please take a look.
Previous Comments:
------------------------------------------------------------------------
[2012-09-02 11:50:39] laruence@php.net
The following patch has been added/updated:
Patch Name: bug62991.phpt
Revision: 1346586639
URL: https://bugs.php.net/patch-display.php?bug=62991&patch=bug62991.phpt&revision=1346586639
------------------------------------------------------------------------
[2012-09-02 11:46:56] laruence@php.net
a new patch has been attached, fixed the memleak issue, but the way is a little
tricky, used the op_array->reserved fields.
so I attached it here instead of ci it, wait for if we can find a better way
------------------------------------------------------------------------
[2012-09-02 11:45:06] laruence@php.net
The following patch has been added/updated:
Patch Name: bug62991.patch
Revision: 1346586306
URL: https://bugs.php.net/patch-display.php?bug=62991&patch=bug62991.patch&revision=1346586306
------------------------------------------------------------------------
[2012-09-02 11:24:00] laruence@php.net
okey, but is there a way to find out that whether a generator has been run once?
leaks reporting if the closure didn't run.
------------------------------------------------------------------------
[2012-09-02 10:26:03] nikic@php.net
Oh, and also, I think it would be a little bit nicer if this:
+ if (execute_data->op_array->fn_flags & ZEND_ACC_CLOSURE) {
+ destroy_op_array(execute_data->op_array);
+ efree(execute_data->op_array);
+ }
would be written as:
+ if (op_array->fn_flags & ZEND_ACC_CLOSURE) {
+ destroy_op_array(op_array);
+ efree(op_array);
+ }
There already is a local op_array variable for execute_data->op_array, so it's a bit shorter
to use ;)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=62991--
Edit this bug report at https://bugs.php.net/bug.php?id=62991&edit=1