php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71601 finally block not executed after yield from
Submitted: 2016-02-15 18:32 UTC Modified: -
From: trowski@php.net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 7.0Git-2016-02-15 (Git) OS: Debian
Private report: No CVE-ID:
 [2016-02-15 18:32 UTC] trowski@php.net
Description:
------------
The finally block in the example generator below is not being executed after delegating to another generator with yield from.

Test script:
---------------
#!/usr/bin/env php
<?php

function gen1() {
    yield 1;
    yield 2;
    yield 3;
    return true;
}

function gen2() {
    try {
        echo "Entered try/catch\n";
        yield from gen1();
    } finally {
        echo "Finally\n";
    }
};

$generator = gen2();

echo $generator->current(), "\n";

unset($generator);

echo "Done\n";


Expected result:
----------------
Entered try/catch
1
Finally
Done

Actual result:
--------------
Entered try/catch
1
Done

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-02-15 21:37 UTC] bwoebi@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=23b770f31fdf893239a185bdb36876c5438eb813
Log: Fixed bug #71601 (finally block not executed after yield from)
 [2016-02-15 21:37 UTC] bwoebi@php.net
-Status: Open +Status: Closed
 [2016-02-15 21:44 UTC] bwoebi@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=23b770f31fdf893239a185bdb36876c5438eb813
Log: Fixed bug #71601 (finally block not executed after yield from)
 [2016-07-20 11:33 UTC] davey@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=23b770f31fdf893239a185bdb36876c5438eb813
Log: Fixed bug #71601 (finally block not executed after yield from)
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Fri Apr 28 08:01:50 2017 UTC