From 09237f612653de2aa236d792e0acc7c27c62f9eb Mon Sep 17 00:00:00 2001 From: Eric Norris Date: Sat, 26 Oct 2019 12:34:43 -0400 Subject: [PATCH] Update request startup error messages --- NEWS | 1 + ext/imap/tests/bug46918.phpt | 2 +- ext/imap/tests/imap_open_error.phpt | 2 +- ext/mbstring/tests/bug63447_001.phpt | 2 +- ext/mbstring/tests/bug63447_002.phpt | 2 +- ext/session/tests/bug60634_error_3.phpt | 2 +- ext/session/tests/bug60634_error_4.phpt | 2 +- ext/session/tests/rfc1867_sid_invalid.phpt | 12 ++++++------ .../tests/session_set_save_handler_iface_002.phpt | 2 +- main/main.c | 15 ++++++++------- sapi/cgi/tests/bug69487.phpt | 4 ++-- tests/basic/025.phpt | 2 +- 12 files changed, 25 insertions(+), 23 deletions(-) diff --git a/NEWS b/NEWS index 4e6881f5421..dc9776a280b 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,7 @@ PHP NEWS . Fixed bug GH-8995 (WeakMap object reference offset causing TypeError). (Tobias Bachert) . Added error_log_mode ini setting. (Mikhail Galanin) + . Updated request startup messages. (Eric Norris) - COM: . Fixed bug GH-8750 (Can not create VT_ERROR variant type). (cmb) diff --git a/ext/imap/tests/bug46918.phpt b/ext/imap/tests/bug46918.phpt index 52e2fbf21a0..c62be631d52 100644 --- a/ext/imap/tests/bug46918.phpt +++ b/ext/imap/tests/bug46918.phpt @@ -68,4 +68,4 @@ array ( 'host' => '.SYNTAX-ERROR.', ), ) -Notice: Unknown: Unexpected characters at end of address: @two (errflg=3) in Unknown on line 0 +Notice: PHP Request Shutdown: Unexpected characters at end of address: @two (errflg=3) in Unknown on line 0 diff --git a/ext/imap/tests/imap_open_error.phpt b/ext/imap/tests/imap_open_error.phpt index 965109db5e8..02ba0006e8c 100644 --- a/ext/imap/tests/imap_open_error.phpt +++ b/ext/imap/tests/imap_open_error.phpt @@ -36,4 +36,4 @@ Warning: imap_open(): Couldn't open stream in %s on line %d imap_open(): Argument #4 ($flags) must be a bitmask of the OP_* constants, and CL_EXPUNGE imap_open(): Argument #5 ($retries) must be greater than or equal to 0 -Notice: Unknown: Can't open mailbox : no such mailbox (errflg=2) in Unknown on line 0 +Notice: PHP Request Shutdown: Can't open mailbox : no such mailbox (errflg=2) in Unknown on line 0 diff --git a/ext/mbstring/tests/bug63447_001.phpt b/ext/mbstring/tests/bug63447_001.phpt index 47a285d74ba..12326acde8d 100644 --- a/ext/mbstring/tests/bug63447_001.phpt +++ b/ext/mbstring/tests/bug63447_001.phpt @@ -13,6 +13,6 @@ a=1&b=2&c=3&d=4&e=5&f=6 var_dump($_POST); ?> --EXPECT-- -Warning: Unknown: Input variables exceeded 5. To increase the limit change max_input_vars in php.ini. in Unknown on line 0 +Warning: PHP Request Startup: Input variables exceeded 5. To increase the limit change max_input_vars in php.ini. in Unknown on line 0 array(0) { } diff --git a/ext/mbstring/tests/bug63447_002.phpt b/ext/mbstring/tests/bug63447_002.phpt index 53a8c364074..859092178ec 100644 --- a/ext/mbstring/tests/bug63447_002.phpt +++ b/ext/mbstring/tests/bug63447_002.phpt @@ -13,6 +13,6 @@ a=1&b=2&c=3&d=4&e=5 var_dump($_POST); ?> --EXPECT-- -Warning: Unknown: Input variables exceeded 4. To increase the limit change max_input_vars in php.ini. in Unknown on line 0 +Warning: PHP Request Startup: Input variables exceeded 4. To increase the limit change max_input_vars in php.ini. in Unknown on line 0 array(0) { } diff --git a/ext/session/tests/bug60634_error_3.phpt b/ext/session/tests/bug60634_error_3.phpt index 5669aa31788..358f40118e2 100644 --- a/ext/session/tests/bug60634_error_3.phpt +++ b/ext/session/tests/bug60634_error_3.phpt @@ -52,4 +52,4 @@ Stack trace: #1 {main} thrown in %s on line %d -Warning: Unknown: Cannot call session save handler in a recursive manner in Unknown on line 0 +Warning: PHP Request Shutdown: Cannot call session save handler in a recursive manner in Unknown on line 0 diff --git a/ext/session/tests/bug60634_error_4.phpt b/ext/session/tests/bug60634_error_4.phpt index a8abedcab18..f9eda46b69b 100644 --- a/ext/session/tests/bug60634_error_4.phpt +++ b/ext/session/tests/bug60634_error_4.phpt @@ -52,4 +52,4 @@ Stack trace: #1 {main} thrown in %s on line %d -Warning: Unknown: Cannot call session save handler in a recursive manner in Unknown on line 0 +Warning: PHP Request Shutdown: Cannot call session save handler in a recursive manner in Unknown on line 0 diff --git a/ext/session/tests/rfc1867_sid_invalid.phpt b/ext/session/tests/rfc1867_sid_invalid.phpt index 265883c96f1..fe01b5a8ba2 100644 --- a/ext/session/tests/rfc1867_sid_invalid.phpt +++ b/ext/session/tests/rfc1867_sid_invalid.phpt @@ -52,17 +52,17 @@ session_destroy(); @unlink(__DIR__ . DIRECTORY_SEPARATOR . "rfc1867_sid_invalid.post.txt"); ?> --EXPECTF-- -Warning: Unknown: Session ID is too long or contains illegal characters. Only the A-Z, a-z, 0-9, "-", and "," characters are allowed in Unknown on line 0 +Warning: PHP Request Startup: Session ID is too long or contains illegal characters. Only the A-Z, a-z, 0-9, "-", and "," characters are allowed in Unknown on line 0 -Warning: Unknown: Failed to read session data: files (path: ) in Unknown on line 0 +Warning: PHP Request Startup: Failed to read session data: files (path: ) in Unknown on line 0 -Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0 +Warning: PHP Request Startup: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0 -Warning: Unknown: Session ID is too long or contains illegal characters. Only the A-Z, a-z, 0-9, "-", and "," characters are allowed in Unknown on line 0 +Warning: PHP Request Startup: Session ID is too long or contains illegal characters. Only the A-Z, a-z, 0-9, "-", and "," characters are allowed in Unknown on line 0 -Warning: Unknown: Failed to read session data: files (path: ) in Unknown on line 0 +Warning: PHP Request Startup: Failed to read session data: files (path: ) in Unknown on line 0 -Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0 +Warning: PHP Request Startup: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0 string(%d) "" bool(true) array(2) { diff --git a/ext/session/tests/session_set_save_handler_iface_002.phpt b/ext/session/tests/session_set_save_handler_iface_002.phpt index 7f826190e31..379b6138c66 100644 --- a/ext/session/tests/session_set_save_handler_iface_002.phpt +++ b/ext/session/tests/session_set_save_handler_iface_002.phpt @@ -89,4 +89,4 @@ bool(true) session_set_save_handler(): Argument #1 ($open) must be of type SessionHandlerInterface, MySession2 given good handler writing -Deprecated: Unknown: Session callback must have a return value of type bool, int returned in Unknown on line 0 +Deprecated: PHP Request Shutdown: Session callback must have a return value of type bool, int returned in Unknown on line 0 diff --git a/main/main.c b/main/main.c index 933ab031dd8..30e05dc26a9 100644 --- a/main/main.c +++ b/main/main.c @@ -965,6 +965,8 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ function = "PHP Startup"; } else if (php_during_module_shutdown()) { function = "PHP Shutdown"; + } else if (PG(during_request_startup)) { + function = "PHP Request Startup"; } else if (EG(current_execute_data) && EG(current_execute_data)->func && ZEND_USER_CODE(EG(current_execute_data)->func->common.type) && @@ -995,14 +997,13 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ default: function = "Unknown"; } + } else if ((function = get_active_function_name()) && strlen(function)) { + is_function = 1; + class_name = get_active_class_name(&space); + } else if (EG(flags) & EG_FLAGS_IN_SHUTDOWN) { + function = "PHP Request Shutdown"; } else { - function = get_active_function_name(); - if (!function || !strlen(function)) { - function = "Unknown"; - } else { - is_function = 1; - class_name = get_active_class_name(&space); - } + function = "Unknown"; } /* if we still have memory then format the origin */ diff --git a/sapi/cgi/tests/bug69487.phpt b/sapi/cgi/tests/bug69487.phpt index 59058809adf..fcda1ac051b 100644 --- a/sapi/cgi/tests/bug69487.phpt +++ b/sapi/cgi/tests/bug69487.phpt @@ -11,8 +11,8 @@ var_dump(isset($_POST['foo'])); var_dump(strlen(file_get_contents('php://input'))); ?> --EXPECT-- -Warning: Unknown: Unable to create temporary file, Check permissions in temporary files directory. in Unknown on line 0 +Warning: PHP Request Startup: Unable to create temporary file, Check permissions in temporary files directory. in Unknown on line 0 -Warning: Unknown: POST data can't be buffered; all data discarded in Unknown on line 0 +Warning: PHP Request Startup: POST data can't be buffered; all data discarded in Unknown on line 0 bool(false) int(0) diff --git a/tests/basic/025.phpt b/tests/basic/025.phpt index 0d00afa3627..6b7340a8609 100644 --- a/tests/basic/025.phpt +++ b/tests/basic/025.phpt @@ -11,7 +11,7 @@ a=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa var_dump($_POST, $HTTP_RAW_POST_DATA); ?> --EXPECTF-- -Warning: Unknown: POST Content-Length of 2050 bytes exceeds the limit of 1024 bytes in Unknown on line 0 +Warning: PHP Request Startup: POST Content-Length of 2050 bytes exceeds the limit of 1024 bytes in Unknown on line 0 Warning: Undefined variable $HTTP_RAW_POST_DATA in %s on line %d array(0) {