rfc:engine_exceptions

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
rfc:engine_exceptions [2013/12/07 15:20] nikicrfc:engine_exceptions [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 2: Line 2:
   * Date: 2013-10-23   * Date: 2013-10-23
   * Author: Nikita Popov <nikic@php.net>   * Author: Nikita Popov <nikic@php.net>
-  * Status: In Voting+  * Status: Declined for 5.6
   * Proposed for: PHP 5.6   * Proposed for: PHP 5.6
   * Patch: https://github.com/nikic/php-src/compare/engineExceptions   * Patch: https://github.com/nikic/php-src/compare/engineExceptions
Line 124: Line 124:
  
 <code php> <code php>
-$lock->aquire();+$lock->acquire();
 try { try {
     doSomething();     doSomething();
Line 143: Line 143:
     public function __construct(Lock $lock) {     public function __construct(Lock $lock) {
         $this->lock = $lock;         $this->lock = $lock;
-        $this->lock->aquire();+        $this->lock->acquire();
     }     }
     public function __destruct() {     public function __destruct() {
Line 151: Line 151:
  
 function test($lock) { function test($lock) {
-    $manager = new LockManager($lock); // aquire lock+    $manager = new LockManager($lock); // acquire lock
          
     doSomething();     doSomething();
Line 309: Line 309:
 ==== Not all errors converted ==== ==== Not all errors converted ====
  
-PHP currently (master on 2013-10-24) contains the following number of fatal-y errors:+The Zend Engine currently (master on 2013-12-10) contains the following number of fatal-y errors:
  
 <code> <code>
-E_ERROR:            439    (note: not counting 538 occurrences in zend_vm_execute.h) +E_ERROR:            183    (note: not counting 538 occurrences in zend_vm_execute.h) 
-E_CORE_ERROR:        14 +E_CORE_ERROR:        12 
-E_COMPILE_ERROR:    145+E_COMPILE_ERROR:    151
 E_PARSE:              1 E_PARSE:              1
-E_RECOVERABLE_ERROR: 21+E_RECOVERABLE_ERROR: 14
 </code> </code>
  
-The patch attached to the RFC currently (as of 2013-10-24) removes 70 ''E_ERROR''and 11 ''E_RECOVERABLE_ERROR''s. While I hope to port more errors to exceptions before the patch is merged, the process is rather time consuming and I will not be able to convert all errors or even most of them. (Note: The number of occurrences in the source code says rather little about what percentage of "actually thrown" errors this constitutes.)+The count was obtained using ''git grep "error[^(]*(E_ERROR_TYPE" Zend | wc -l'' and as such may not be totally accurate, but should be a good approximation.
  
-Some errors are easy to change to exceptions, others are more complicated. Some are nigh impossible, like the memory limit or execution time limit errors. The ''E_CORE_ERROR'' type can't be converted to use exceptions because it occurs during startup (at least if used correctly). ''E_COMPILE_ERROR'' (and ''E_PARSE'') currently also can't be converted to exceptions, due to concerns regarding global state modifications.+The patch attached to the RFC currently (as of 2013-10-24) removes 70 ''E_ERROR''s and 11 ''E_RECOVERABLE_ERROR''s. While I hope to port more errors to exceptions before the patch is merged, the process is rather time consuming and I will not be able to convert all errors. (Note: The number of occurrences in the source code says rather little about what percentage of "actually thrown" errors this constitutes.) 
 + 
 +Some errors are easy to change to exceptions, others are more complicated. Some are impossible, like the memory limit or execution time limit errors. The ''E_CORE_ERROR'' type can't be converted to use exceptions because it occurs during startup (at least if used correctly). ''E_COMPILE_ERROR'' (and ''E_PARSE'') currently also can't be converted to exceptions, due to concerns regarding global state modifications.
  
 Converting most existing errors will take some time and in the meantime we'll be in a situation where some part of the errors were converted to exceptions but another part stays fatal. From a user perspective it may not be immediately clear when one is used over the other. Converting most existing errors will take some time and in the meantime we'll be in a situation where some part of the errors were converted to exceptions but another part stays fatal. From a user perspective it may not be immediately clear when one is used over the other.
Line 329: Line 331:
 ===== Backwards compatibility ===== ===== Backwards compatibility =====
  
-The ''E_FATAL'' portion of this proposal does not break backwards compatibility: All code that was previously working, will continue to work. The change only relaxes error conditions, which is a change we do not regard as breaking BC.+The ''E_ERROR'' portion of this proposal does not break backwards compatibility: All code that was previously working, will continue to work. The change only relaxes error conditions, which is generally not regarded as breaking BC.
  
-The ''E_RECOVERABLE_FATAL'' part of the proposal may introduce a minor BC break, because it will no longer allow to silently ignore recoverable errors with a custom error handler. As this point is somewhat controversial I'll have a separate voting option for this.+The ''E_RECOVERABLE_ERROR'' part of the proposal may introduce a minor BC break, because it will no longer allow to silently ignore recoverable errors with a custom error handler. As this point is somewhat controversial I'll have a separate voting option for this.
  
 ===== Patch ===== ===== Patch =====
Line 347: Line 349:
 If you are in favor of this proposal in general, but not for PHP 5.6, use the "No" voting option. If you are in favor of this proposal in general, but not for PHP 5.6, use the "No" voting option.
  
-<doodle title="Implement in PHP 5.6?" auth="nikic" voteType="single" closed="false">+<doodle title="Implement in PHP 5.6?" auth="nikic" voteType="single" closed="true">
    * Yes    * Yes
    * Yes, without E_RECOVERABLE_ERROR changes    * Yes, without E_RECOVERABLE_ERROR changes
Line 353: Line 355:
 </doodle> </doodle>
  
-Vote started on 2013-12-07 and ends on 2013-12-14.+Vote started on 2013-12-07 and ended on 2013-12-14.
rfc/engine_exceptions.1386429651.txt.gz · Last modified: 2017/09/22 13:28 (external edit)