Doc #76006 [NEW]: PHP engine execute the code after shutdown_function by "finally" block

From: Date: Sun, 25 Feb 2018 13:46:09 +0000
Subject: Doc #76006 [NEW]: PHP engine execute the code after shutdown_function by "finally" block
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15464@lists.php.net to get a copy of this message
From: maestroprog at gmail dot com Operating system: Ubuntu Artful PHP version: 7.2.2 Package: Scripting Engine problem Bug Type: Documentation Problem Bug description:PHP engine execute the code after shutdown_function by "finally" block 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. -- Edit bug report at https://bugs.php.net/bug.php?id=76006&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76006&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76006&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76006&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76006&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76006&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76006&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76006&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76006&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76006&r=support Expected behavior: https://bugs.php.net/fix.php?id=76006&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76006&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76006&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76006&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76006&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76006&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76006&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76006&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76006&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76006&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76006&r=mysqlcfg

« previous php.doc.bugs (#15464) next »