php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75396 Exit inside generator finally results in fatal error
Submitted: 2017-10-17 08:18 UTC Modified: -
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: [email protected] Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 7.2.0RC4 OS:
Private report: No CVE-ID: None
 [2017-10-17 08:18 UTC] [email protected]
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.

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-11-06 10:38 UTC] 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
 [2018-01-11 09:39 UTC] [email protected]
This seems to also affect generators without `finally`.

https://github.com/kelunik/acme-client/commit/56955155feab5c473b7281d06ee46e735f915bcd
 [2018-01-12 20:28 UTC] [email protected]
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jun 10 02:01:26 2025 UTC