rfc:finally

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
rfc:finally [2012/08/06 13:37] – [Changelog] laruencerfc:finally [2012/10/19 21:33] – [Request for Comments: Supports finally keyword] googleguy
Line 2: Line 2:
   * Version: 1.0   * Version: 1.0
   * Date: 2012/07/24   * Date: 2012/07/24
-  * Author: Xinchen Hui <laruence.php.net> +  * Author: Xinchen Hui <laruence@php.net> 
-  * Status: Under Discussion+  * Status: Implemented
   * First Published at: http://wiki.php.net/rfc/finally   * First Published at: http://wiki.php.net/rfc/finally
 +  * Alternative Reading: <Finally Getting finally In PHP?> http://sheriframadan.com/2012/08/finally-keyword-in-php/  by GoogleGuy
  
 ===== Introduction ===== ===== Introduction =====
Line 12: Line 13:
 <code php> <code php>
 <?php <?php
-$db = mysql_connect();+$db = mysqli_connect();
 try { try {
    call_some_function($db);    call_some_function($db);
 } catch (Exception $e) { } catch (Exception $e) {
-   mysql_close($db);+   mysqli_close($db);
    throw $e;    throw $e;
 } }
Line 28: Line 29:
 <code php> <code php>
 <?php <?php
-$db = mysql_connect();+$db = mysqli_connect();
 try { try {
    call_some_function($db);//the function may throw exceptions which we can not handle    call_some_function($db);//the function may throw exceptions which we can not handle
 } finally { } finally {
-   mysql_close($db);+   mysqli_close($db);
 } }
 </code> </code>
Line 86: Line 87:
 123432int(1) 123432int(1)
 </code> </code>
 +
 + There are also lots of edge cases could be found in the Test&Examples section blow
 ===== Patch ===== ===== Patch =====
   * Patch: https://github.com/laruence/php-src/tree/finally   * Patch: https://github.com/laruence/php-src/tree/finally
-  * Tests & Examples:+===== Tests & Examples =====
       * https://github.com/laruence/php-src/blob/finally/Zend/tests/catch_finally_001.phpt       * https://github.com/laruence/php-src/blob/finally/Zend/tests/catch_finally_001.phpt
       * https://github.com/laruence/php-src/blob/finally/Zend/tests/catch_finally_002.phpt       * https://github.com/laruence/php-src/blob/finally/Zend/tests/catch_finally_002.phpt
Line 101: Line 104:
 ===== Vote ===== ===== Vote =====
 <doodle  <doodle 
-title="Should the implementation be merged into trunk?" auth="laruence" voteType="single" closed="false">+title="Should the implementation be merged into trunk?" auth="laruence" voteType="single" closed="true">
    * Yes    * Yes
    * No    * No
Line 109: Line 112:
   * 2012/07/26 Xinchen Hui: Update RFC     * 2012/07/26 Xinchen Hui: Update RFC  
   * 2012/08/06 Xinchen Hui: Open voting   * 2012/08/06 Xinchen Hui: Open voting
 +  * 2012/08/13 Xinchen Hui: Close voting, RFC win the voting
 +  * 2012/08/15 Xinchen Hui: Committed
rfc/finally.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1