]> granicus.if.org Git - php/commitdiff
- Add E_RECOVERABLE.
authorDerick Rethans <derick@php.net>
Thu, 15 Sep 2005 16:19:48 +0000 (16:19 +0000)
committerDerick Rethans <derick@php.net>
Thu, 15 Sep 2005 16:19:48 +0000 (16:19 +0000)
#- Thought I did this before already actually...

22 files changed:
Zend/tests/array_type_hint_001.phpt
Zend/tests/bug33996.phpt
Zend/zend.c
Zend/zend_constants.c
Zend/zend_errors.h
Zend/zend_execute.c
ext/mcrypt/mcrypt.c
ext/session/session.c
ext/simplexml/simplexml.c
ext/simplexml/tests/012.phpt
ext/spl/tests/array_013.phpt
main/main.c
php.ini-dist
php.ini-recommended
run-tests.php
tests/classes/array_access_003.phpt
tests/classes/private_003.phpt
tests/classes/type_hinting_001.phpt
tests/lang/bug24658.phpt
tests/lang/type_hints_001.phpt
tests/run-test/test005.phpt
tests/run-test/test008a.phpt

index b110622aeba1a1c2b0a23001b06804578b049ace..def85b39bd1bc4d2b4f332b787d50b56e903438c 100755 (executable)
@@ -12,4 +12,4 @@ foo(123);
 --EXPECTF--
 3
 
-Fatal error: Argument 1 must be an array, called in %sarray_type_hint_001.php on line 7 and defined in %sarray_type_hint_001.php on line 2
+Catchable fatal error: Argument 1 must be an array, called in %sarray_type_hint_001.php on line 7 and defined in %sarray_type_hint_001.php on line 2
index 9b52f02a8fd2e6f7bd9b4618ac9101df1b56a99d..a56bae1675c1e5cd2ce541729b88dfc3e6e00402 100755 (executable)
@@ -26,4 +26,4 @@ FooTest(new Foo());
 --EXPECTF--
 Warning: Missing argument 1 for NormalTest(), called in %sbug33996.php on line 17 and defined in %sbug33996.php on line 12
 Hi!
-Fatal error: Argument 1 must be an object of class Foo, called in %sbug33996.php on line 18 and defined in %sbug33996.php on line 7
+Catchable fatal error: Argument 1 must be an object of class Foo, called in %sbug33996.php on line 18 and defined in %sbug33996.php on line 7
index 4532e1e06c293819cd9f393b3339105bc75ffee4..8de73997a117eb5390b48f967c28f1819f304c03 100644 (file)
@@ -1672,6 +1672,7 @@ ZEND_API void zend_error(int type, const char *format, ...)
                case E_USER_ERROR:
                case E_USER_WARNING:
                case E_USER_NOTICE:
+               case E_RECOVERABLE_ERROR:
                        if (zend_is_compiling(TSRMLS_C)) {
                                error_filename = zend_get_compiled_filename(TSRMLS_C);
                                error_lineno = zend_get_compiled_lineno(TSRMLS_C);
index 79d86182201102fd7011d0f1a7fbe87bebf6a965..5c4eab9442fc21b0cc6eeb912d82b1f22c99efa0 100644 (file)
@@ -94,6 +94,7 @@ int zend_startup_constants(TSRMLS_D)
 void zend_register_standard_constants(TSRMLS_D)
 {
        REGISTER_MAIN_LONG_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS);
+       REGISTER_MAIN_LONG_CONSTANT("E_RECOVERABLE_ERROR", E_RECOVERABLE_ERROR, CONST_PERSISTENT | CONST_CS);
        REGISTER_MAIN_LONG_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT | CONST_CS);
        REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS);
        REGISTER_MAIN_LONG_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS);
index c89bbfe01104114e3d909ae28653a86ad28b8daa..9c8fa88be3c51854cba11701bac19c989ce7a65c 100644 (file)
@@ -34,8 +34,9 @@
 #define E_USER_WARNING         (1<<9L)
 #define E_USER_NOTICE          (1<<10L)
 #define E_STRICT                       (1<<11L)
+#define E_RECOVERABLE_ERROR            (1<<12L)
 
-#define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE)
+#define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE | E_RECOVERABLE_ERROR)
 #define E_CORE (E_CORE_ERROR | E_CORE_WARNING)
 
 #endif /* ZEND_ERRORS_H */
index 67cb38e1e27d1dc4229fd2ede26c701cc5f353ac..787f768a8242e6b07f4b06ae20826ad8e0cadd54 100644 (file)
@@ -487,18 +487,18 @@ static inline void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zv
        if (cur_arg_info->class_name) {
                if (!arg) {
                        if (ptr && ptr->op_array) {
-                               zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an object of class %v, called in %s on line %d and defined", arg_num, fclass, fsep, fname, cur_arg_info->class_name, ptr->op_array->filename, ptr->opline->lineno);
+                               zend_error(E_RECOVERABLE_ERROR, "Argument %d passed to %s%s%s() must be an object of class %v, called in %s on line %d and defined", arg_num, fclass, fsep, fname, cur_arg_info->class_name, ptr->op_array->filename, ptr->opline->lineno);
                        } else {
-                               zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an object of class %v", arg_num, fclass, fsep, fname, cur_arg_info->class_name);
+                               zend_error(E_RECOVERABLE_ERROR, "Argument %d passed to %s%s%s() must be an object of class %v", arg_num, fclass, fsep, fname, cur_arg_info->class_name);
                        }
                }
                switch (Z_TYPE_P(arg)) {
                        case IS_NULL:
                                if (!cur_arg_info->allow_null) {
                                        if (ptr && ptr->op_array) {
-                                               zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must not be null, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
+                                               zend_error(E_RECOVERABLE_ERROR, "Argument %d passed to %s%s%s() must not be null, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
                                        } else {
-                                               zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must not be null", arg_num, fclass, fsep, fname);
+                                               zend_error(E_RECOVERABLE_ERROR, "Argument %d passed to %s%s%s() must not be null", arg_num, fclass, fsep, fname);
                                        }
                                }
                                break;
@@ -513,36 +513,36 @@ static inline void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zv
                                                        error_msg = "be an instance of";
                                                }
                                                if (ptr && ptr->op_array) {
-                                                       zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must %s %v, called in %s on line %d and defined", arg_num, fclass, fsep, fname, error_msg, ce->name, ptr->op_array->filename, ptr->opline->lineno);
+                                                       zend_error(E_RECOVERABLE_ERROR, "Argument %d passed to %s%s%s() must %s %v, called in %s on line %d and defined", arg_num, fclass, fsep, fname, error_msg, ce->name, ptr->op_array->filename, ptr->opline->lineno);
                                                } else {
-                                                       zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must %s %v", arg_num, fclass, fsep, fname, error_msg, ce->name);
+                                                       zend_error(E_RECOVERABLE_ERROR, "Argument %d passed to %s%s%s() must %s %v", arg_num, fclass, fsep, fname, error_msg, ce->name);
                                                }
                                        }
                                }
                                break;
                        default:
                                if (ptr && ptr->op_array) {
-                                       zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an object of class %v, called in %s on line %d and defined", arg_num, fclass, fsep, fname, cur_arg_info->class_name, ptr->op_array->filename, ptr->opline->lineno);
+                                       zend_error(E_RECOVERABLE_ERROR, "Argument %d passed to %s%s%s() must be an object of class %v, called in %s on line %d and defined", arg_num, fclass, fsep, fname, cur_arg_info->class_name, ptr->op_array->filename, ptr->opline->lineno);
                                } else {
-                                       zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an object of class %v", arg_num, fclass, fsep, fname, cur_arg_info->class_name);
+                                       zend_error(E_RECOVERABLE_ERROR, "Argument %d passed to %s%s%s() must be an object of class %v", arg_num, fclass, fsep, fname, cur_arg_info->class_name);
                                }
                                break;
                }
        }       else if (cur_arg_info->array_type_hint) {
                if (!arg) {
                        if (ptr && ptr->op_array) {
-                               zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an array, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
+                               zend_error(E_RECOVERABLE_ERROR, "Argument %d passed to %s%s%s() must be an array, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
                        } else { 
-                               zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an array", arg_num, fclass, fsep, fname);
+                               zend_error(E_RECOVERABLE_ERROR, "Argument %d passed to %s%s%s() must be an array", arg_num, fclass, fsep, fname);
                        }
                }
                switch (Z_TYPE_P(arg)) {
                        case IS_NULL:
                                if (!cur_arg_info->allow_null) {
                                        if (ptr && ptr->op_array) {
-                                               zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must not be null, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
+                                               zend_error(E_RECOVERABLE_ERROR, "Argument %d passed to %s%s%s() must not be null, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
                                        } else {
-                                               zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must not be null", arg_num, fclass, fsep, fname);
+                                               zend_error(E_RECOVERABLE_ERROR, "Argument %d passed to %s%s%s() must not be null", arg_num, fclass, fsep, fname);
                                        }
                                }
                                break;
@@ -550,9 +550,9 @@ static inline void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zv
                                break;
                        default:        
                                if (ptr && ptr->op_array) {
-                                       zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an array, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
+                                       zend_error(E_RECOVERABLE_ERROR, "Argument %d passed to %s%s%s() must be an array, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
                                } else {
-                                       zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an array", arg_num, fclass, fsep, fname);
+                                       zend_error(E_RECOVERABLE_ERROR, "Argument %d passed to %s%s%s() must be an array", arg_num, fclass, fsep, fname);
                                }
                                break;
                }
index 352af2c8244d3867a3f00f23464ba09e8d09be5d..3d7a5ef72c6e2b24adeb1efd488ca7e683f3532c 100644 (file)
@@ -1075,7 +1075,8 @@ static void php_mcrypt_do_crypt (char* cipher, zval **key, zval **data, char *mo
        }
 
        if (mcrypt_generic_init(td, key_s, use_key_length, iv_s) < 0) {
-               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Mcrypt initialisation failed");
+               php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Mcrypt initialisation failed");
+               RETURN_FALSE;
        }
        if (dencrypt == MCRYPT_ENCRYPT) {
                mcrypt_generic(td, data_s, data_size);
index 571c4523b6b9b1717eddde8031adf62b7c9437ec..cbe30f4424cdd1c2b9e12b6af392087be5c0e01e 100644 (file)
@@ -100,6 +100,7 @@ static PHP_INI_MH(OnUpdateSaveHandler)
 
        if (PG(modules_activated) && !PS(mod)) {
                php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot find save handler %s", new_value);
+               return FAILURE;
        }
 
        return SUCCESS;
@@ -126,6 +127,7 @@ static PHP_INI_MH(OnUpdateSerializer)
 
        if (PG(modules_activated) && !PS(serializer)) {
                php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot find serialization handler %s", new_value);
+               return FAILURE;
        }
 
        return SUCCESS;
index 3aa725d5818c34a7d22d6faddef159da4f3baa6f..2338c4f7d632b2c6ac4ac4d28a99672e7fdfbfeb 100644 (file)
@@ -1093,6 +1093,7 @@ static zval *sxe_get_value(zval *z TSRMLS_DC)
 
        if (sxe_object_cast(z, retval, IS_STRING, 0 TSRMLS_CC)==FAILURE) {
                zend_error(E_ERROR, "Unable to cast node to string");
+               /* FIXME: Should not be fatal */
        }
 
        retval->refcount = 0;
@@ -1152,6 +1153,7 @@ static zend_object_value sxe_object_ze1_clone(zval *zobject TSRMLS_DC)
 {
        php_error(E_ERROR, "Cannot clone object of class %v due to 'zend.ze1_compatibility_mode'", Z_OBJCE_P(zobject)->name);
        /* Return zobject->value.obj just to satisfy compiler */
+       /* FIXME: Should not be a fatal */
        return zobject->value.obj;
 }
 
index 79c01107fe8768d1b7595af5f41f2b49e6104583..4bf7e1a0ec15669690282fd6fae13b7074d7e57f 100755 (executable)
@@ -36,4 +36,4 @@ Warning: main(): Cannot write or create unnamed attribute in %s012.php on line %
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <foo attr="new value"/>
 
-Fatal error: main(): Cannot create unnamed attribute in %s012.php on line %d
+Catchable fatal error: main(): Cannot create unnamed attribute in %s012.php on line %d
index 6d74bcb419b3a5a5aa5b375d703f3e402a6a4802..905b8339c9a3c025051329e7d4e26b89398e615a 100755 (executable)
@@ -78,4 +78,4 @@ one=>1
 two=>2
 ===Append===
 
-Fatal error: ArrayIterator::append(): Cannot append properties to objects, use ArrayIterator::offsetSet() instead in %sarray_013.php on line %d
+Catchable fatal error: ArrayIterator::append(): Cannot append properties to objects, use ArrayIterator::offsetSet() instead in %sarray_013.php on line %d
index aad569f0e56f1f988087726c18562e9f4c68b535..de461dd7fe9b124a0a055992ebe1e4fa022f79bd 100644 (file)
@@ -805,6 +805,9 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
                        case E_USER_ERROR:
                                error_type_str = "Fatal error";
                                break;
+                       case E_RECOVERABLE_ERROR:
+                               error_type_str = "Catchable fatal error";
+                               break;
                        case E_WARNING:
                        case E_CORE_WARNING:
                        case E_COMPILE_WARNING:
@@ -886,6 +889,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
                        }
                /* no break - intentionally */
                case E_ERROR:
+               case E_RECOVERABLE_ERROR:
                /* case E_PARSE: the parser would return 1 (failure), we can bail out nicely */
                case E_COMPILE_ERROR:
                case E_USER_ERROR:
index afa73d6afc74b6c8ff76ce31dbdfc2cf4b2dcd47..dd2955c1346937ee27518ad704be2c6145ff4cee 100644 (file)
@@ -254,6 +254,7 @@ memory_limit = 8M      ; Maximum amount of memory a script may consume (8MB)
 ; reporting level
 ; E_ALL             - All errors and warnings (doesn't include E_STRICT)
 ; E_ERROR           - fatal run-time errors
+; E_RECOVERABLE_ERROR     - almost fatal run-time errors
 ; E_WARNING         - run-time warnings (non-fatal errors)
 ; E_PARSE           - compile-time parse errors
 ; E_NOTICE          - run-time notices (these are warnings which often result
@@ -285,7 +286,7 @@ memory_limit = 8M      ; Maximum amount of memory a script may consume (8MB)
 ;
 ;   - Show only errors
 ;
-;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
+;error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
 ;
 ;   - Show all errors except for notices and coding standards warnings
 ;
index e6b9abf44485c774237c8c15f4d9ea1427184ff6..65757e3ebea6688b89ea0b1686b95bdf9f93dcd3 100644 (file)
@@ -312,6 +312,7 @@ memory_limit = 8M      ; Maximum amount of memory a script may consume (8MB)
 ; reporting level
 ; E_ALL             - All errors and warnings (doesn't include E_STRICT)
 ; E_ERROR           - fatal run-time errors
+; E_RECOVERABLE_ERROR     - almost fatal run-time errors
 ; E_WARNING         - run-time warnings (non-fatal errors)
 ; E_PARSE           - compile-time parse errors
 ; E_NOTICE          - run-time notices (these are warnings which often result
@@ -343,7 +344,7 @@ memory_limit = 8M      ; Maximum amount of memory a script may consume (8MB)
 ;
 ;   - Show only errors
 ;
-;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
+;error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
 ;
 ;   - Show all errors, except coding standards warnings
 ;
index 4453a4ffac3851111ba3f18681ab06a43247e217..6ca4196453ea40dcf1355e784db51bbcb5a758ad 100755 (executable)
@@ -143,7 +143,7 @@ $ini_overwrites = array(
                'safe_mode=0',
                'disable_functions=',
                'output_buffering=Off',
-               'error_reporting=4095',
+               'error_reporting=8191',
                'display_errors=1',
                'log_errors=0',
                'html_errors=0',
index 7c65bedaf6ec9bb2439964a76b61021ce2c64343..df0fde9f79e48f4f7cd8044d734b63b6f75f6dec 100644 (file)
@@ -1,7 +1,7 @@
 --TEST--
 ZE2 ArrayAccess::offsetGet ambiguties
 --INI--
-error_reporting=4095
+error_reporting=8191
 --FILE--
 <?php
 class object implements ArrayAccess {
index 716efbc8c781f7220080cded171bef0ccc4dc305..d7fc45fcdc12bff7b0f9acb41d7398b7bf524bfd 100644 (file)
@@ -4,7 +4,6 @@ ZE2 A private method cannot be called in a derived class
 <?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
 --FILE--
 <?php
-ini_set("error_reporting",2039);
 class pass {
        private static function show() {
                echo "Call show()\n";
index c46e420ab6646de3a0a7bba6d532badbbcb765f4..ff9c61f63311bfe72b6f7314d627144c93cb36d0 100644 (file)
@@ -35,4 +35,4 @@ $a->b($b);
 ?>
 --EXPECTF--
 
-Fatal error: Argument 1 must implement interface Foo, called in %s on line 27 and defined in %s on line 12
+Catchable fatal error: Argument 1 must implement interface Foo, called in %s on line 27 and defined in %s on line 12
index 399fd32cac7ddba5983fa674f41d2dec66a06f3d..f799b17d5c04ad77c899e5e1c33cf81d0b0fca0e 100644 (file)
@@ -53,4 +53,4 @@ int(2)
 object(foo)#%d (0) {
 }
 
-Fatal error: Argument 1 must be an object of class foo in %s on line %d
+Catchable fatal error: Argument 1 must be an object of class foo in %s on line %d
index 2aea3e703ee239146d047209bd752977a4649184..2af109632cf83062532f1127c45f78386cb84e1b 100644 (file)
@@ -23,4 +23,4 @@ type_hint_foo($bar);
 ?>
 --EXPECTF--
 
-Fatal error: Argument 1 must be an instance of Foo, called in %s on line 16 and defined in %s on line 9
+Catchable fatal error: Argument 1 must be an instance of Foo, called in %s on line 16 and defined in %s on line 9
index b54cbc50e65b650736cdd98d883f63482c510de8..d16a66ef7a0a857f44ebc2a3823139ac86692320 100644 (file)
@@ -24,7 +24,7 @@ var_dump($php_errormsg);
 ?>
 --EXPECTF--
 string(1) "1"
-string(4) "4095"
+string(4) "8191"
 string(1) "0"
 string(1) "1"
 string(1) "0"
index 7916ff2352b1271ca78ce704012f07b02719c01f..a7d360dc64e7cd0fc94a7885afa89fc4e70ec236 100644 (file)
@@ -24,7 +24,7 @@ var_dump($php_errormsg);
 ?>
 --EXPECTF--
 string(1) "1"
-string(4) "4095"
+string(4) "8191"
 string(1) "0"
 string(1) "1"
 string(1) "0"