]> granicus.if.org Git - php/commitdiff
Fix exceptions thrown without a stack frame
authorZeev Suraski <zeev@php.net>
Wed, 11 Feb 2004 12:31:18 +0000 (12:31 +0000)
committerZeev Suraski <zeev@php.net>
Wed, 11 Feb 2004 12:31:18 +0000 (12:31 +0000)
Always enable set_exception_handler()

Zend/zend.c
Zend/zend_execute_API.c

index 9d4bcc283b1287c476792fa2a2e98dabe84e7216..d7c34069f5f05c8fa3cd3773592690b313c6247a 100644 (file)
@@ -1057,7 +1057,6 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
                                } else {
                                        strcpy(ex_class_name, "Unknown Exception");
                                }
-#if 1 /* support set_exception_handler() */
                                if (EG(user_exception_handler)) {
                                        zval *orig_user_exception_handler;
                                        zval ***params, *retval2, *old_exception;
@@ -1090,11 +1089,6 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
                                        zval_ptr_dtor(EG(return_value_ptr_ptr));
                                        local_retval = NULL;
                                }
-#else
-                               zend_exception_error(EG(exception) TSRMLS_CC);
-                               zval_ptr_dtor(&EG(exception));
-                               EG(exception) = NULL;
-#endif
                        } else if (!retval) {
                                zval_ptr_dtor(EG(return_value_ptr_ptr));
                                local_retval = NULL;
index dc1a90313c7ca21476fad4634aeff0be96cb389e..3ace0a2565cfb9a09d602b88974ddfc99c18a4c6 100644 (file)
@@ -1200,6 +1200,10 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC)
                }
                EG(exception) = exception;
        }
+       if (!EG(current_execute_data)) {
+               zend_error(E_ERROR, "Exception thrown without a stack frame");
+       }
+
        if ((EG(current_execute_data)->opline+1)->opcode == ZEND_HANDLE_EXCEPTION) {
                /* no need to rethrow the exception */
                return;