Bug #75396 [Com]: Exit inside generator finally results in fatal error

From: Date: Thu, 11 Jan 2018 09:39:45 +0000
Subject: Bug #75396 [Com]: Exit inside generator finally results in fatal error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213465@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75396&edit=1

 ID:                 75396
 Comment by:         kelunik@php.net
 Reported by:        kelunik@php.net
 Summary:            Exit inside generator finally results in fatal error
 Status:             Open
 Type:               Bug
 Package:            Scripting Engine problem
 PHP Version:        7.2.0RC4
 Block user comment: N
 Private report:     N

 New Comment:

This seems to also affect generators without finally.

https://github.com/kelunik/acme-client/commit/56955155feab5c473b7281d06ee46e735f915bcd


Previous Comments:
------------------------------------------------------------------------
[2017-11-06 10:38:12] bashofmann at gmail dot com

Maybe something like this is also the root cause for the segfault here https://bugs.php.net/bug.php?id=75351

------------------------------------------------------------------------
[2017-10-17 08:18:23] kelunik@php.net

Description:
------------
See example. It doesn't continue the generator anywhere, it just exists.

Test script:
---------------
<?php

$gen = (function () {
    yield 42;

    try {
    } finally {
        exit;
    }
})();

$gen->send("x");

Expected result:
----------------
Clean exit.

Actual result:
--------------
Fatal error: Cannot resume an already running generator.


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



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


Thread (4 messages)

« previous php.bugs (#213465) next »