rfc:improved_error_callback_mechanism

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
Next revisionBoth sides next revision
rfc:improved_error_callback_mechanism [2015/04/08 00:26] – changed modify date patrickallaertrfc:improved_error_callback_mechanism [2015/04/21 16:47] patrickallaert
Line 2: Line 2:
   * Version: 0.2   * Version: 0.2
   * Create Date: 2015-03-13   * Create Date: 2015-03-13
-  * Modify Date: 2015-04-08+  * Modify Date: 2015-04-14
   * Author: Patrick Allaert <patrick@catchy.io>, Olivier Garcia <olivier@catchy.io>   * Author: Patrick Allaert <patrick@catchy.io>, Olivier Garcia <olivier@catchy.io>
   * Status: Under discussion   * Status: Under discussion
Line 32: Line 32:
 An extension that want to extend one of the part can do it so by **appending** a hook: An extension that want to extend one of the part can do it so by **appending** a hook:
 <code c> <code c>
-    PHP_ERROR_HOOK_API my_logging_hook(PHP_ERROR_HOOK_ARGS) {+    ZEND_API void my_logging_hook(ZEND_ERROR_CB_HOOK_ARGS) {
         /* Do some logging with error line number, filename, message, ... */         /* Do some logging with error line number, filename, message, ... */
     }     }
Line 39: Line 39:
 </code> </code>
  
-**Prepending** is also possible in the case one want to execute a hook before the other of the same category:+**Prepending** is also possible in the case one want to execute a hook before the others of the same category:
 <code c> <code c>
-    PHP_ERROR_HOOK_API my_logging_hook(PHP_ERROR_HOOK_ARGS) { 
-        /* Do some logging with error line number, filename, message, ... */ 
-    } 
- 
     zend_prepend_error_hook(E_HOOK_LOG, my_logging_hook);     zend_prepend_error_hook(E_HOOK_LOG, my_logging_hook);
 </code> </code>
  
-An extension that want to **clear** one of the part can do it so with:+An extension that want to **clear** all hooks from a specific category can do it so with:
 <code c> <code c>
     zend_clear_error_hook(E_HOOK_DISPLAY);     zend_clear_error_hook(E_HOOK_DISPLAY);
Line 55: Line 51:
  
 ''zend_append_error_hook'', ''zend_prepend_error_hook'' and ''zend_clear_error_hook'' will operate on one of the internal linked lists of error hooks. There will be one linked list for each parts, referred to with one of the constants: ''E_HOOK_DISPLAY'', ''E_HOOK_LOG'', ''E_HOOK_PROCESS'' or ''E_HOOK_BAILOUT''. Those linked lists will, by default, contain the original implementation. ''zend_append_error_hook'', ''zend_prepend_error_hook'' and ''zend_clear_error_hook'' will operate on one of the internal linked lists of error hooks. There will be one linked list for each parts, referred to with one of the constants: ''E_HOOK_DISPLAY'', ''E_HOOK_LOG'', ''E_HOOK_PROCESS'' or ''E_HOOK_BAILOUT''. Those linked lists will, by default, contain the original implementation.
 +
 +The modification of hook lists must be done during the MINIT phase.
  
 ==== Overview of the improved ''php_error_cb'' ==== ==== Overview of the improved ''php_error_cb'' ====
Line 82: Line 80:
  
 ==== Open discussions point ==== ==== Open discussions point ====
-Should the implementation contain pre and post hooks that would be empty by default? It would enable extensions to do some treatment at the early/lately phase.+Should the implementation also contain pre and post hook lists that would be empty by default? It would enable extensions to do some treatment at the early/lately phase.
  
 ===== Backward incompatible changes ===== ===== Backward incompatible changes =====
Line 102: Line 100:
  
 ===== Patches and tests ===== ===== Patches and tests =====
-The patch is under creation by Patrick Allaert and Olivier Garcia+The patch has been created by Patrick Allaert and Olivier Garcia
 + 
 +PR available at: https://github.com/php/php-src/pull/1247
  
 ===== Implementation ===== ===== Implementation =====
Line 122: Line 122:
  
   * 0.1: Initial RFC (2015-03-13)   * 0.1: Initial RFC (2015-03-13)
-  * 0.2: Changing API a bit + possibility to prepend hooks as suggested by Derick + fixing E_HOOK_PROCESS hooks placement (2015-04-07)+  * 0.2: Changing API slightly + possibility to prepend hooks as suggested by Derick + fixing E_HOOK_PROCESS hooks placement (2015-04-07) 
rfc/improved_error_callback_mechanism.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1