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: kelunik@php.net 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] 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.

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

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] kelunik@php.net
This seems to also affect generators without `finally`.

https://github.com/kelunik/acme-client/commit/56955155feab5c473b7281d06ee46e735f915bcd
 [2018-01-12 20:28 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=420d11e8caf8dc76e08984dfed3a4322295a1208
Log: Fixed bug #75396
 [2018-01-12 20:28 UTC] nikic@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC