]> granicus.if.org Git - php/commitdiff
fix usage of php_output_(de)activate; I guess this code doesn't bother about one...
authorMichael Wallner <mike@php.net>
Tue, 31 Jan 2012 10:47:21 +0000 (10:47 +0000)
committerMichael Wallner <mike@php.net>
Tue, 31 Jan 2012 10:47:21 +0000 (10:47 +0000)
sapi/cli/php_cli_server.c

index ffb971618fae03344d479c02c092a7b80f5d52f3..e8b626197832bf5e757ba7d55e6b5c9d5d679aee 100644 (file)
@@ -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));