Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request #69654: Add E_DEBUG and E_USER_DEBUG constants #1290

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Zend/zend_builtin_functions.c
Expand Up @@ -1649,6 +1649,7 @@ ZEND_FUNCTION(trigger_error)
case E_USER_WARNING:
case E_USER_NOTICE:
case E_USER_DEPRECATED:
case E_USER_DEBUG:
break;
default:
zend_error(E_WARNING, "Invalid error type specified");
Expand Down
2 changes: 2 additions & 0 deletions Zend/zend_constants.c
Expand Up @@ -120,6 +120,7 @@ void zend_register_standard_constants(void)
REGISTER_MAIN_LONG_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_STRICT", E_STRICT, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_DEPRECATED", E_DEPRECATED, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_DEBUG", E_DEBUG, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_CORE_ERROR", E_CORE_ERROR, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_CORE_WARNING", E_CORE_WARNING, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_ERROR", E_COMPILE_ERROR, CONST_PERSISTENT | CONST_CS);
Expand All @@ -128,6 +129,7 @@ void zend_register_standard_constants(void)
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_USER_DEBUG", E_USER_DEBUG, CONST_PERSISTENT | CONST_CS);

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

Expand Down
6 changes: 4 additions & 2 deletions Zend/zend_errors.h
Expand Up @@ -37,10 +37,12 @@
#define E_RECOVERABLE_ERROR (1<<12L)
#define E_DEPRECATED (1<<13L)
#define E_USER_DEPRECATED (1<<14L)
#define E_DEBUG (1<<15L)
#define E_USER_DEBUG (1<<16L)

#define E_EXCEPTION (1<<15L)
#define E_EXCEPTION (1<<17L)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know people should haven't written code that is hard-coded against the value of E_EXCEPTION, but some people will have. Adding the two new values at the end of the list would break less stuff.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, useful information. i'll research it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Danack this is irrelevant … E_EXCEPTION is PHP 7 only and never exported as constant to userland.


#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 | E_STRICT)
#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 | E_STRICT | E_DEBUG | E_USER_DEBUG)
#define E_CORE (E_CORE_ERROR | E_CORE_WARNING)

#endif /* ZEND_ERRORS_H */
Expand Down
2 changes: 1 addition & 1 deletion ext/soap/php_http.c
Expand Up @@ -190,7 +190,7 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
}

old_error_reporting = EG(error_reporting);
EG(error_reporting) &= ~(E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE);
EG(error_reporting) &= ~(E_WARNING|E_NOTICE|E_DEBUG|E_USER_WARNING|E_USER_NOTICE|E_USER_DEBUG);

/* Changed ternary operator to an if/else so that additional comparisons can be done on the ssl_method property */
if (use_ssl && !*use_proxy) {
Expand Down
8 changes: 8 additions & 0 deletions main/main.c
Expand Up @@ -1028,6 +1028,10 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
case E_USER_NOTICE:
/* notices are no errors and are not treated as such like E_WARNINGS */
break;
case E_DEBUG:
case E_USER_DEBUG:
/* debug is debug, it is not exception */
break;
default:
/* throw an exception if we are in EH_THROW mode
* but DO NOT overwrite a pending exception
Expand Down Expand Up @@ -1075,6 +1079,10 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
case E_USER_DEPRECATED:
error_type_str = "Deprecated";
break;
case E_DEBUG:
case E_USER_DEBUG:
error_type_str = "Debug";
break;
default:
error_type_str = "Unknown error";
break;
Expand Down