|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-02-25 13:51 UTC] kelunik@php.net
-Status: Open
+Status: Not a bug
[2018-02-25 13:51 UTC] kelunik@php.net
[2018-02-25 13:53 UTC] kelunik@php.net
[2018-02-25 14:26 UTC] maestroprog at gmail dot com
[2018-02-25 17:42 UTC] kelunik@php.net
[2018-02-25 22:23 UTC] maestroprog at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 08:00:02 2026 UTC |
Description: ------------ It seems I've found a curious undocumented feature of the code execution "finally" after the shutdown_function. Test script: --------------- <?php register_shutdown_function(function () { echo 'BYE BY SHUTDOWN', PHP_EOL; register_shutdown_function(function () { echo 'BYE BY LAST SHUTDOWN', PHP_EOL; }); }); function shutdown(): \Generator { try { yield; } finally { echo 'PHP SUPER SHUTDOWN', PHP_EOL; } } $generator = shutdown(); $generator->rewind(); Expected result: ---------------- Code from finally executed never, since the generator is not iterated until the end, or "finally" code executed before shutdown_function. php test.php BYE BY SHUTDOWN BYE BY LAST SHUTDOWN Actual result: -------------- php test.php BYE BY SHUTDOWN BYE BY LAST SHUTDOWN PHP SUPER SHUTDOWN Code from finally block executed after ALL shutdown_functions.