Add E_USER_DEPRECATED (patch by Lars Strojny)

This commit is contained in:
Hannes Magnusson 2008-07-21 09:36:21 +00:00
parent 637e591a3d
commit 5919165375
9 changed files with 18 additions and 8 deletions

View file

@ -9,20 +9,19 @@ var_dump(trigger_error(array()));
var_dump(trigger_error("error", -1)); var_dump(trigger_error("error", -1));
var_dump(trigger_error("error", 0)); var_dump(trigger_error("error", 0));
var_dump(trigger_error("error", E_USER_WARNING)); var_dump(trigger_error("error", E_USER_WARNING));
var_dump(trigger_error("error", E_USER_DEPRECATED));
echo "Done\n"; echo "Done\n";
?> ?>
--EXPECTF-- --EXPECTF--
Warning: Wrong parameter count for trigger_error() in %s on line %d Warning: trigger_error() expects at least 1 parameter, 0 given in %s on line %d
NULL NULL
Notice: error in %s on line %d Notice: error in %s on line %d
bool(true) bool(true)
Notice: Array to string conversion in %s on line %d Warning: trigger_error() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d
NULL
Notice: Array in %s on line %d
bool(true)
Warning: Invalid error type specified in %s on line %d Warning: Invalid error type specified in %s on line %d
bool(false) bool(false)
@ -32,4 +31,7 @@ bool(false)
Warning: error in %s on line %d Warning: error in %s on line %d
bool(true) bool(true)
Deprecated: error in %s on line %d
bool(true)
Done Done

View file

@ -1521,6 +1521,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
case E_USER_ERROR: case E_USER_ERROR:
case E_USER_WARNING: case E_USER_WARNING:
case E_USER_NOTICE: case E_USER_NOTICE:
case E_USER_DEPRECATED:
case E_RECOVERABLE_ERROR: case E_RECOVERABLE_ERROR:
if (zend_is_compiling(TSRMLS_C)) { if (zend_is_compiling(TSRMLS_C)) {
error_filename = zend_get_compiled_filename(TSRMLS_C); error_filename = zend_get_compiled_filename(TSRMLS_C);

View file

@ -1480,6 +1480,7 @@ ZEND_FUNCTION(trigger_error)
case E_USER_ERROR: case E_USER_ERROR:
case E_USER_WARNING: case E_USER_WARNING:
case E_USER_NOTICE: case E_USER_NOTICE:
case E_USER_DEPRECATED:
break; break;
default: default:
zend_error(E_WARNING, "Invalid error type specified"); zend_error(E_WARNING, "Invalid error type specified");

View file

@ -112,6 +112,7 @@ void zend_register_standard_constants(TSRMLS_D) /* {{{ */
REGISTER_MAIN_LONG_CONSTANT("E_USER_ERROR", E_USER_ERROR, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_USER_ERROR", E_USER_ERROR, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_USER_WARNING", E_USER_WARNING, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_USER_WARNING", E_USER_WARNING, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_USER_NOTICE", E_USER_NOTICE, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_USER_NOTICE", E_USER_NOTICE, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_USER_DEPRECATED", E_USER_DEPRECATED, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS);

View file

@ -36,8 +36,9 @@
#define E_STRICT (1<<11L) #define E_STRICT (1<<11L)
#define E_RECOVERABLE_ERROR (1<<12L) #define E_RECOVERABLE_ERROR (1<<12L)
#define E_DEPRECATED (1<<13L) #define E_DEPRECATED (1<<13L)
#define E_USER_DEPRECATED (1<<14L)
#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_STRICT | E_RECOVERABLE_ERROR | E_DEPRECATED) #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_STRICT | E_RECOVERABLE_ERROR | E_DEPRECATED | E_USER_DEPRECATED)
#define E_CORE (E_CORE_ERROR | E_CORE_WARNING) #define E_CORE (E_CORE_ERROR | E_CORE_WARNING)
#endif /* ZEND_ERRORS_H */ #endif /* ZEND_ERRORS_H */

View file

@ -944,6 +944,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
break; break;
case E_STRICT: case E_STRICT:
case E_DEPRECATED: case E_DEPRECATED:
case E_USER_DEPRECATED:
/* for the sake of BC to old damaged code */ /* for the sake of BC to old damaged code */
break; break;
case E_NOTICE: case E_NOTICE:
@ -994,6 +995,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
error_type_str = "Strict Standards"; error_type_str = "Strict Standards";
break; break;
case E_DEPRECATED: case E_DEPRECATED:
case E_USER_DEPRECATED:
error_type_str = "Deprecated"; error_type_str = "Deprecated";
break; break;
default: default:

View file

@ -245,6 +245,7 @@ memory_limit = 128M ; Maximum amount of memory a script may consume (128M)
; E_USER_NOTICE - user-generated notice message ; E_USER_NOTICE - user-generated notice message
; E_DEPRECATED - warn about code that will not work in future versions ; E_DEPRECATED - warn about code that will not work in future versions
; of PHP ; of PHP
; E_USER_DEPRECATED - user-generated deprecation warnings
; ;
; Examples: ; Examples:
; ;

View file

@ -282,6 +282,7 @@ memory_limit = 128M ; Maximum amount of memory a script may consume (128M)
; E_USER_NOTICE - user-generated notice message ; E_USER_NOTICE - user-generated notice message
; E_DEPRECATED - warn about code that will not work in future versions ; E_DEPRECATED - warn about code that will not work in future versions
; of PHP ; of PHP
; E_USER_DEPRECATED - user-generated deprecation warnings
; ;
; Examples: ; Examples:
; ;

View file

@ -166,7 +166,7 @@ $ini_overwrites = array(
'open_basedir=', 'open_basedir=',
'disable_functions=', 'disable_functions=',
'output_buffering=Off', 'output_buffering=Off',
'error_reporting=16383', 'error_reporting=30719',
'display_errors=1', 'display_errors=1',
'display_startup_errors=1', 'display_startup_errors=1',
'log_errors=0', 'log_errors=0',