- Add E_RECOVERABLE.

#- Thought I did this before already actually...
This commit is contained in:
Derick Rethans 2005-09-15 16:19:48 +00:00
parent 50301ddc98
commit 0f391bb0b3
22 changed files with 43 additions and 30 deletions

View File

@ -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

View File

@ -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

View 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);

View 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);

View 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 */

View 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;
}

View 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);

View 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;

View 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;
}

View File

@ -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

View File

@ -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

View 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:

View 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
;

View 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
;

View File

@ -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',

View File

@ -1,7 +1,7 @@
--TEST--
ZE2 ArrayAccess::offsetGet ambiguties
--INI--
error_reporting=4095
error_reporting=8191
--FILE--
<?php
class object implements ArrayAccess {

View 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";

View 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

View 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

View 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

View 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"

View 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"