From d619b57efa42c81eb4632d1794747f074cc3fb91 Mon Sep 17 00:00:00 2001 From: Hannes Magnusson Date: Mon, 21 Jul 2008 09:41:00 +0000 Subject: [PATCH] MFH: Add E_USER_DEPRECATED (patch by Lars Strojny) --- NEWS | 4 ++-- Zend/tests/015.phpt | 4 ++++ Zend/zend.c | 1 + Zend/zend_builtin_functions.c | 1 + Zend/zend_constants.c | 1 + Zend/zend_errors.h | 3 ++- main/main.c | 2 ++ php.ini-dist | 1 + php.ini-recommended | 1 + run-tests.php | 2 +- 10 files changed, 16 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 91b261e99c..5701f8956e 100644 --- a/NEWS +++ b/NEWS @@ -33,8 +33,8 @@ PHP NEWS . Added __DIR__ constant. (Lars Strojny) . Added PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, PHP_EXTRA_VERSION, PHP_VERSION_ID, PHP_ZTS and PHP_DEBUG constants. (Pierre) - . Added new error mode E_DEPRECATED which is used to inform about stuff to be - dropped in future PHP versions. (Lars Strojny, Felipe, Marcus) + . Added new error modes E_USER_DEPRECATED and E_DEPRECATED which is used to inform + about stuff to be dropped in future PHP versions. (Lars Strojny, Felipe, Marcus) . Added "request_order" INI variable to control specifically $_REQUEST behavior. (Stas) . Added support for exception linking. (Marcus) diff --git a/Zend/tests/015.phpt b/Zend/tests/015.phpt index b8b2338861..ffe1a4f94e 100644 --- a/Zend/tests/015.phpt +++ b/Zend/tests/015.phpt @@ -9,6 +9,7 @@ var_dump(trigger_error(array())); var_dump(trigger_error("error", -1)); var_dump(trigger_error("error", 0)); var_dump(trigger_error("error", E_USER_WARNING)); +var_dump(trigger_error("error", E_USER_DEPRECATED)); echo "Done\n"; ?> @@ -30,4 +31,7 @@ bool(false) Warning: error in %s on line %d bool(true) + +Deprecated: error in %s on line %d +bool(true) Done diff --git a/Zend/zend.c b/Zend/zend.c index 42e8efd9b1..0e35dd40cc 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -1000,6 +1000,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_USER_DEPRECATED: case E_RECOVERABLE_ERROR: if (zend_is_compiling(TSRMLS_C)) { error_filename = zend_get_compiled_filename(TSRMLS_C); diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 5beb229426..5680646092 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -1479,6 +1479,7 @@ ZEND_FUNCTION(trigger_error) case E_USER_ERROR: case E_USER_WARNING: case E_USER_NOTICE: + case E_USER_DEPRECATED: break; default: zend_error(E_WARNING, "Invalid error type specified"); diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index 3ca4a29e8c..c672b5e4c6 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -109,6 +109,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_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_DEPRECATED", E_USER_DEPRECATED, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS); diff --git a/Zend/zend_errors.h b/Zend/zend_errors.h index 1f5d0e74bb..708a2dce00 100644 --- a/Zend/zend_errors.h +++ b/Zend/zend_errors.h @@ -36,8 +36,9 @@ #define E_STRICT (1<<11L) #define E_RECOVERABLE_ERROR (1<<12L) #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_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_RECOVERABLE_ERROR | E_DEPRECATED | E_USER_DEPRECATED) #define E_CORE (E_CORE_ERROR | E_CORE_WARNING) #endif /* ZEND_ERRORS_H */ diff --git a/main/main.c b/main/main.c index ea7ed5d837..2501a98418 100644 --- a/main/main.c +++ b/main/main.c @@ -844,6 +844,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ break; case E_STRICT: case E_DEPRECATED: + case E_USER_DEPRECATED: /* for the sake of BC to old damaged code */ break; case E_NOTICE: @@ -894,6 +895,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ error_type_str = "Strict Standards"; break; case E_DEPRECATED: + case E_USER_DEPRECATED: error_type_str = "Deprecated"; break; default: diff --git a/php.ini-dist b/php.ini-dist index 89f773ccab..a744e56de8 100644 --- a/php.ini-dist +++ b/php.ini-dist @@ -295,6 +295,7 @@ memory_limit = 128M ; Maximum amount of memory a script may consume (128MB) ; E_USER_NOTICE - user-generated notice message ; E_DEPRECATED - warn about code that will not work in future versions ; of PHP +; E_USER_DEPRECATED - user-generated deprecation warnings ; ; Examples: ; diff --git a/php.ini-recommended b/php.ini-recommended index ce9f532a63..2c531c7664 100644 --- a/php.ini-recommended +++ b/php.ini-recommended @@ -344,6 +344,7 @@ memory_limit = 128M ; Maximum amount of memory a script may consume (128MB) ; E_USER_NOTICE - user-generated notice message ; E_DEPRECATED - warn about code that will not work in future versions ; of PHP +; E_USER_DEPRECATED - user-generated deprecation warnings ; ; Examples: ; diff --git a/run-tests.php b/run-tests.php index 4110f7ceb8..e406b66f70 100755 --- a/run-tests.php +++ b/run-tests.php @@ -177,7 +177,7 @@ $ini_overwrites = array( 'safe_mode=0', 'disable_functions=', 'output_buffering=Off', - 'error_reporting=16383', + 'error_reporting=30719', 'display_errors=1', 'display_startup_errors=1', 'log_errors=0', -- 2.50.1