From: Michael Wallner Date: Tue, 31 Jan 2012 10:47:21 +0000 (+0000) Subject: fix usage of php_output_(de)activate; I guess this code doesn't bother about one... X-Git-Tag: php-5.4.0RC7~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=93c549913fd113a82680d3ad86d3ec8e18dc1187;p=php fix usage of php_output_(de)activate; I guess this code doesn't bother about one more hack; --- diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index ffb971618f..e8b6261978 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -1755,11 +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 { + 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); + 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));