Skip to content

Commit d619b57

Browse files
committed
MFH: Add E_USER_DEPRECATED (patch by Lars Strojny)
1 parent 4fb0cec commit d619b57

File tree

10 files changed

+16
-4
lines changed

10 files changed

+16
-4
lines changed

NEWS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ PHP NEWS
3333
. Added __DIR__ constant. (Lars Strojny)
3434
. Added PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION,
3535
PHP_EXTRA_VERSION, PHP_VERSION_ID, PHP_ZTS and PHP_DEBUG constants. (Pierre)
36-
. Added new error mode E_DEPRECATED which is used to inform about stuff to be
37-
dropped in future PHP versions. (Lars Strojny, Felipe, Marcus)
36+
. Added new error modes E_USER_DEPRECATED and E_DEPRECATED which is used to inform
37+
about stuff to be dropped in future PHP versions. (Lars Strojny, Felipe, Marcus)
3838
. Added "request_order" INI variable to control specifically $_REQUEST behavior.
3939
(Stas)
4040
. Added support for exception linking. (Marcus)

Zend/tests/015.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var_dump(trigger_error(array()));
99
var_dump(trigger_error("error", -1));
1010
var_dump(trigger_error("error", 0));
1111
var_dump(trigger_error("error", E_USER_WARNING));
12+
var_dump(trigger_error("error", E_USER_DEPRECATED));
1213

1314
echo "Done\n";
1415
?>
@@ -30,4 +31,7 @@ bool(false)
3031

3132
Warning: error in %s on line %d
3233
bool(true)
34+
35+
Deprecated: error in %s on line %d
36+
bool(true)
3337
Done

Zend/zend.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
10001000
case E_USER_ERROR:
10011001
case E_USER_WARNING:
10021002
case E_USER_NOTICE:
1003+
case E_USER_DEPRECATED:
10031004
case E_RECOVERABLE_ERROR:
10041005
if (zend_is_compiling(TSRMLS_C)) {
10051006
error_filename = zend_get_compiled_filename(TSRMLS_C);

Zend/zend_builtin_functions.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,7 @@ ZEND_FUNCTION(trigger_error)
14791479
case E_USER_ERROR:
14801480
case E_USER_WARNING:
14811481
case E_USER_NOTICE:
1482+
case E_USER_DEPRECATED:
14821483
break;
14831484
default:
14841485
zend_error(E_WARNING, "Invalid error type specified");

Zend/zend_constants.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ void zend_register_standard_constants(TSRMLS_D)
109109
REGISTER_MAIN_LONG_CONSTANT("E_USER_ERROR", E_USER_ERROR, CONST_PERSISTENT | CONST_CS);
110110
REGISTER_MAIN_LONG_CONSTANT("E_USER_WARNING", E_USER_WARNING, CONST_PERSISTENT | CONST_CS);
111111
REGISTER_MAIN_LONG_CONSTANT("E_USER_NOTICE", E_USER_NOTICE, CONST_PERSISTENT | CONST_CS);
112+
REGISTER_MAIN_LONG_CONSTANT("E_USER_DEPRECATED", E_USER_DEPRECATED, CONST_PERSISTENT | CONST_CS);
112113

113114
REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS);
114115

Zend/zend_errors.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@
3636
#define E_STRICT (1<<11L)
3737
#define E_RECOVERABLE_ERROR (1<<12L)
3838
#define E_DEPRECATED (1<<13L)
39+
#define E_USER_DEPRECATED (1<<14L)
3940

40-
#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)
41+
#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)
4142
#define E_CORE (E_CORE_ERROR | E_CORE_WARNING)
4243

4344
#endif /* ZEND_ERRORS_H */

main/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
844844
break;
845845
case E_STRICT:
846846
case E_DEPRECATED:
847+
case E_USER_DEPRECATED:
847848
/* for the sake of BC to old damaged code */
848849
break;
849850
case E_NOTICE:
@@ -894,6 +895,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
894895
error_type_str = "Strict Standards";
895896
break;
896897
case E_DEPRECATED:
898+
case E_USER_DEPRECATED:
897899
error_type_str = "Deprecated";
898900
break;
899901
default:

php.ini-dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ memory_limit = 128M ; Maximum amount of memory a script may consume (128MB)
295295
; E_USER_NOTICE - user-generated notice message
296296
; E_DEPRECATED - warn about code that will not work in future versions
297297
; of PHP
298+
; E_USER_DEPRECATED - user-generated deprecation warnings
298299
;
299300
; Examples:
300301
;

php.ini-recommended

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ memory_limit = 128M ; Maximum amount of memory a script may consume (128MB)
344344
; E_USER_NOTICE - user-generated notice message
345345
; E_DEPRECATED - warn about code that will not work in future versions
346346
; of PHP
347+
; E_USER_DEPRECATED - user-generated deprecation warnings
347348
;
348349
; Examples:
349350
;

run-tests.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ function verify_config()
177177
'safe_mode=0',
178178
'disable_functions=',
179179
'output_buffering=Off',
180-
'error_reporting=16383',
180+
'error_reporting=30719',
181181
'display_errors=1',
182182
'display_startup_errors=1',
183183
'log_errors=0',

0 commit comments

Comments
 (0)