Skip to content

Update request startup error messages #4865

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

Closed
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/imap/tests/bug46918.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion ext/imap/tests/imap_open_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion ext/mbstring/tests/bug63447_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}
2 changes: 1 addition & 1 deletion ext/mbstring/tests/bug63447_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}
2 changes: 1 addition & 1 deletion ext/session/tests/bug60634_error_3.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion ext/session/tests/bug60634_error_4.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 6 additions & 6 deletions ext/session/tests/rfc1867_sid_invalid.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 9 additions & 8 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,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) &&
Expand Down Expand Up @@ -984,14 +986,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 */
Expand Down Expand Up @@ -1745,7 +1746,7 @@ zend_result php_request_startup(void)
CWDG(realpath_cache_size_limit) = 0;
}

if (PG(expose_php)) {
if (PG(expose_php) && !SG(headers_sent)) {
sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1);
}

Expand Down
6 changes: 2 additions & 4 deletions sapi/cgi/tests/bug69487.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +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: Cannot modify header information - headers already sent 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)
4 changes: 1 addition & 3 deletions tests/basic/025.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +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: Cannot modify header information - headers already sent 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) {
Expand Down