Re: [PATCH] fix for apache1 syntax highlighter
| From: | Moriyoshi Koizumi | Date: | Fri, 16 May 2003 20:10:44 +0000 |
| Subject: | Re: [PATCH] fix for apache1 syntax highlighter | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-1612@lists.php.net to get a copy of this message | ||
oops, wrong patch.
Here's the correct one.
Moriyoshi
Moriyoshi Koizumi <moriyoshi@at.wakwak.com> wrote:
> 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 20:06:59 -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) == SUCCESS ? OK : NOT_FOUND); } 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 20:06:59 -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) == SUCCESS ? OK : NOT_FOUND); } 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; } /* }}} */