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

 ID:                 63066
 Updated by:         dmi...@php.net
 Reported by:        Jared dot Williams1 at ntlworld dot com
 Summary:            Calling an undefined method in a generator results
                     in a seg fault
-Status:             Assigned
+Status:             Closed
 Type:               Bug
 Package:            Class/Object related
 Operating System:   Linux ubuntu 3.5.0-14-generic #1
 PHP Version:        master-Git-2012-09-11 (Git)
 Assigned To:        dmitry
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of dmi...@zend.com
Revision: 
http://git.php.net/?p=php-src.git;a=commit;h=66b8ece02a9592fb70d1ca2990614004858c4e8b
Log: Fixed bug #63066 (Calling an undefined method in a generator results in a 
seg fault) (fixed with previous commit).


Previous Comments:
------------------------------------------------------------------------
[2012-09-21 14:54:34] ni...@php.net

@dmitry: I opened up a separate bug for the issue you mentioned: 
https://bugs.php.net/bug.php?id=63132

------------------------------------------------------------------------
[2012-09-21 13:22:43] dmi...@php.net

Nikita, you patch must solve the particular problem, but not the general one. I 
just realized that "yield" is not just a statement, but may be used anywhere in 
expression context and even receive data. I expect, we may have more edge case 
troubles (e.g. memory leaks because of nested pass/call sequences) 

<?php
class C {
        function foo($x,$y) {
                var_dump($x,$y);
                return $x + $y;
        }
}

function gen($obj,$a,$b,$c) {
  $obj->foo($a, $obj->foo($b, $obj->foo($c, yield)));
}

$gen = gen(new C, 1, 2, 3);
$gen->current();
?>

Also it's absolutely unclear why I can use yield with expression as first 
argument, but not as the socond.

foo(yield "ok");    // works fine

foo(0, yield "ok"); // parse error

------------------------------------------------------------------------
[2012-09-21 13:03:15] dmi...@php.net

Nikita,

------------------------------------------------------------------------
[2012-09-12 02:07:18] larue...@php.net

yeah, of course, my patch is just a hint :)

assign to dmitry, dmitry, could you please look at this? 

thanks

------------------------------------------------------------------------
[2012-09-11 16:50:56] ni...@php.net

There are several fatal errors that may trigger this. I added another patch 
that 
fixes (hopefully?) all of them.

Instead of loading the object directly into EX(object) I first put it into a 
temporary variable and only assign it to EX(object) after everything's good.

Does this seem reasonable?

------------------------------------------------------------------------


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=63066


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63066&edit=1

Reply via email to