[PATCH] fix for apache1 syntax highlighter
| From: | Moriyoshi Koizumi | Date: | Fri, 16 May 2003 20:08:31 +0000 |
| Subject: | [PATCH] fix for apache1 syntax highlighter | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-1611@lists.php.net to get a copy of this message | ||
Hi,
Attached is the patch for apache1 SAPI which fixes the issue that
the syntax highter doesn't work with output buffering enabled.
The patch simply tries to call php_request_shutdown() even under
display_source_mode because php_request_startup() is called anytime in
prior to the highlight_file() call.
If there are no objections, I'll commit this patch shortly.
Regards,
Moriyoshi
Index: sapi/apache/sapi_apache.c =================================================================== RCS file: /repository/php4/sapi/apache/sapi_apache.c,v retrieving revision 1.40.4.1 diff -u -r1.40.4.1 sapi_apache.c --- sapi/apache/sapi_apache.c 31 Dec 2002 16:26:59 -0000 1.40.4.1 +++ sapi/apache/sapi_apache.c 16 May 2003 19:55:45 -0000 @@ -27,6 +27,7 @@ */ int apache_php_module_main(request_rec *r, int display_source_mode TSRMLS_DC) { + int retval = OK; zend_file_handle file_handle; if (php_request_startup(TSRMLS_C) == FAILURE) { @@ -40,11 +41,7 @@ zend_syntax_highlighter_ini syntax_highlighter_ini; php_get_highlight_struct(&syntax_highlighter_ini); - if (highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC)){ - return OK; - } else { - return NOT_FOUND; - } + retval = highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC); } else { file_handle.type = ZEND_HANDLE_FILENAME; file_handle.handle.fd = 0; @@ -61,7 +58,7 @@ php_request_shutdown(NULL); } zend_end_try(); - return (OK); + return retval; } /* }}} */
Index: sapi/apache/sapi_apache.c =================================================================== RCS file: /repository/php4/sapi/apache/sapi_apache.c,v retrieving revision 1.40.4.1 diff -u -r1.40.4.1 sapi_apache.c --- sapi/apache/sapi_apache.c 31 Dec 2002 16:26:59 -0000 1.40.4.1 +++ sapi/apache/sapi_apache.c 16 May 2003 19:55:45 -0000 @@ -27,6 +27,7 @@ */ int apache_php_module_main(request_rec *r, int display_source_mode TSRMLS_DC) { + int retval = OK; zend_file_handle file_handle; if (php_request_startup(TSRMLS_C) == FAILURE) { @@ -40,11 +41,7 @@ zend_syntax_highlighter_ini syntax_highlighter_ini; php_get_highlight_struct(&syntax_highlighter_ini); - if (highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC)){ - return OK; - } else { - return NOT_FOUND; - } + retval = highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC); } else { file_handle.type = ZEND_HANDLE_FILENAME; file_handle.handle.fd = 0; @@ -61,7 +58,7 @@ php_request_shutdown(NULL); } zend_end_try(); - return (OK); + return retval; } /* }}} */