Skip to content

Issue 43177 #98

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
wants to merge 6 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,13 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
va_end(args);

if (type == E_PARSE) {
EG(exit_status) = 255;
/* eval() errors do not affect exit_status */
if (!(EG(current_execute_data) &&
EG(current_execute_data)->opline &&
EG(current_execute_data)->opline->opcode == ZEND_INCLUDE_OR_EVAL &&
EG(current_execute_data)->opline->extended_value == ZEND_EVAL)) {
EG(exit_status) = 255;
}
zend_init_compiler_data_structures(TSRMLS_C);
}
}
Expand Down
14 changes: 12 additions & 2 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1123,11 +1123,20 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
case E_PARSE:
case E_COMPILE_ERROR:
case E_USER_ERROR:
EG(exit_status) = 255;
{ /* new block to allow variable definition */
/* eval() errors do not affect exit_status or response code */
zend_bool during_eval = (EG(current_execute_data) &&
EG(current_execute_data)->opline &&
EG(current_execute_data)->opline->opcode == ZEND_INCLUDE_OR_EVAL &&
EG(current_execute_data)->opline->extended_value == ZEND_EVAL);
if (!during_eval) {
EG(exit_status) = 255;
}
if (module_initialized) {
if (!PG(display_errors) &&
!SG(headers_sent) &&
SG(sapi_headers).http_response_code == 200
SG(sapi_headers).http_response_code == 200 &&
!during_eval
) {
sapi_header_line ctr = {0};

Expand All @@ -1148,6 +1157,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
}
}
break;
}
}

/* Log if necessary */
Expand Down