diff options
| author | Ondřej Surý <ondrej@sury.org> | 2012-02-03 11:02:43 +0100 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2012-02-03 11:02:43 +0100 |
| commit | 5292df2401c781de56fd04835c18e11162152626 (patch) | |
| tree | 34d9215e87887fb4f97b051ac3fa239d6cf4ee89 /sapi/cli | |
| parent | 96fb2ff5760132a915766f1d9ec7c63001feacd8 (diff) | |
| download | php-5292df2401c781de56fd04835c18e11162152626.tar.gz | |
Imported Upstream version 5.4.0~rc7upstream/5.4.0_rc7
Diffstat (limited to 'sapi/cli')
| -rw-r--r-- | sapi/cli/php_cli_server.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index d702e8ad1..e8b626197 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -325,6 +325,9 @@ static const char *get_template_string(int code) /* {{{ */ static void append_http_status_line(smart_str *buffer, int protocol_version, int response_code, int persistent) /* {{{ */ { + if (!response_code) { + response_code = 200; + } smart_str_appendl_ex(buffer, "HTTP", 4, persistent); smart_str_appendc_ex(buffer, '/', persistent); smart_str_append_generic_ex(buffer, protocol_version / 100, persistent, int, _unsigned); @@ -1752,13 +1755,22 @@ static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server int err = 0; zval *style = NULL; zend_try { - php_output_activate(TSRMLS_C); + if (!SG(sapi_started)) { + php_output_activate(TSRMLS_C); + } php_output_start_user(NULL, 0, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC); php_info_print_style(TSRMLS_C); MAKE_STD_ZVAL(style); php_output_get_contents(style TSRMLS_CC); php_output_discard(TSRMLS_C); - php_output_deactivate(TSRMLS_C); + if (!SG(sapi_started)) { + static int (*send_header_func)(sapi_headers_struct * TSRMLS_DC); + send_header_func = sapi_module.send_headers; + /* we don't want the header to be sent now */ + sapi_module.send_headers = sapi_cli_server_discard_headers; + php_output_deactivate(TSRMLS_C); + sapi_module.send_headers = send_header_func; + } if (style && Z_STRVAL_P(style)) { char *block = pestrndup(Z_STRVAL_P(style), Z_STRLEN_P(style), 1); php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new(block, block, Z_STRLEN_P(style)); |
