helly           Fri Aug  8 13:18:31 2008 UTC

  Modified files:              
    /ZendEngine2        zend_execute_API.c 
    /php-src/main       php.h 
  Log:
  - PHP 5.3 todo, store error handling mode on stack when executing internal
    or overloaded functions and methods. The issue is that a function might
    set and rely on a certain mode and then calls another internal function
    which changes it again, probably changing it back to the normal mode.
    With this change we need to drop all calls that change the mode back to
    normal using php_std_error_handling(). However there might be places
    where someone wants to restore the last mode. If there is such a case we
    need to add two functions one to save and one to restore. I briefly on
    this and not all cases are clear, especially one in sqlite but that seems
    to be a rather misleading comment. Eitherway I chose to not drop and mark
    as deprecated for now.
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.456&r2=1.457&diff_format=u
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.456 
ZendEngine2/zend_execute_API.c:1.457
--- ZendEngine2/zend_execute_API.c:1.456        Fri Aug  1 14:21:45 2008
+++ ZendEngine2/zend_execute_API.c      Fri Aug  8 13:18:30 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_execute_API.c,v 1.456 2008/08/01 14:21:45 dmitry Exp $ */
+/* $Id: zend_execute_API.c,v 1.457 2008/08/08 13:18:30 helly Exp $ */
 
 #include <stdio.h>
 #include <signal.h>
@@ -947,12 +947,16 @@
                EG(opline_ptr) = original_opline_ptr;
        } else if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) 
{
                int call_via_handler = 
(EX(function_state).function->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0;
+               zend_error_handling_t  error_handling  = EG(error_handling);
+               zend_class_entry      *exception_class = EG(exception_class);
 
                ALLOC_INIT_ZVAL(*fci->retval_ptr_ptr);
                if (EX(function_state).function->common.scope) {
                        EG(scope) = EX(function_state).function->common.scope;
                }
                ((zend_internal_function *) 
EX(function_state).function)->handler(fci->param_count, *fci->retval_ptr_ptr, 
fci->retval_ptr_ptr, (fci->object_pp?*fci->object_pp:NULL), 1 TSRMLS_CC);
+               EG(error_handling)  = error_handling;
+               EG(exception_class) = exception_class;
                /*      We shouldn't fix bad extensions here,
                    because it can break proper ones (Bug #34045)
                if (!EX(function_state).function->common.return_reference)
@@ -969,12 +973,15 @@
                        fci_cache->initialized = 0;
                }
        } else { /* ZEND_OVERLOADED_FUNCTION */
-
                ALLOC_INIT_ZVAL(*fci->retval_ptr_ptr);
 
                        /* Not sure what should be done here if it's a static 
method */
                if (fci->object_pp) {
+                       zend_error_handling_t  error_handling  = 
EG(error_handling);
+                       zend_class_entry      *exception_class = 
EG(exception_class);
                        
Z_OBJ_HT_PP(fci->object_pp)->call_method(EX(function_state).function->common.function_name,
 fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr, *fci->object_pp, 
1 TSRMLS_CC);
+                       EG(error_handling)  = error_handling;
+                       EG(exception_class) = exception_class;
                } else {
                        zend_error_noreturn(E_ERROR, "Cannot call overloaded 
function for non-object");
                }
http://cvs.php.net/viewvc.cgi/php-src/main/php.h?r1=1.244&r2=1.245&diff_format=u
Index: php-src/main/php.h
diff -u php-src/main/php.h:1.244 php-src/main/php.h:1.245
--- php-src/main/php.h:1.244    Tue Jun 24 05:59:11 2008
+++ php-src/main/php.h  Fri Aug  8 13:18:31 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php.h,v 1.244 2008/06/24 05:59:11 kalle Exp $ */
+/* $Id: php.h,v 1.245 2008/08/08 13:18:31 helly Exp $ */
 
 #ifndef PHP_H
 #define PHP_H
@@ -287,7 +287,7 @@
 
 BEGIN_EXTERN_C()
 PHPAPI void php_set_error_handling(error_handling_t error_handling, 
zend_class_entry *exception_class TSRMLS_DC);
-#define php_std_error_handling() php_set_error_handling(EH_NORMAL, NULL 
TSRMLS_CC)
+static ZEND_ATTRIBUTE_DEPRECATED void php_std_error_handling() {}
 
 PHPAPI void php_verror(const char *docref, const char *params, int type, const 
char *format, va_list args TSRMLS_DC);
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to