|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-10-18 18:22 UTC] kalle@php.net
-Status: Open
+Status: Wont fix
[2017-10-18 18:22 UTC] kalle@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 00:00:01 2025 UTC |
Description: ------------ The PHP experimental apache2filter code (e.g. --with-apxs2filter) does not properly handle syntax highlighting requests, despite the documentation stating such should work. Taken from sapi/apache2filter/README: 36 At the end of conf/httpd.conf, add: 37 38 AddType application/x-httpd-php .php 39 40 If you would like to enable source code highlighting functionality add: 41 42 AddType application/x-httpd-php-source .phps sapi/apache2filter/sapi_apache2.c has the following code: 670 static void php_insert_filter(request_rec *r) 671 { 672 int content_type_len = strlen("application/x-httpd-php"); 673 674 if (r->content_type && !strncmp(r->content_type, "application/x-httpd-php", content_type_len-1)) { 675 if (r->content_type[content_type_len] == '\0' || !strncmp(r->content_type+content_type_len, "-source", sizeo f("-source"))) { 676 php_add_filter(r, r->output_filters); 677 php_add_filter(r, r->input_filters); 678 } 679 } 680 } Translated to English, all this does is cause Content-Type application/x-httpd-source documents to be parsed and run, not sent through the syntax highlighter. Testing a fetch of a .phps document confirms this; the code gets run, with no output. This is incorrect behaviour when compared to what the README states. If you compare the above code to that of, say, sapi/apache2handler/sapi_apache2.c, you will find that the handler (not filter) code there does extra work to make sure such requests get shoved through the syntax highlighter. Solution: Please pick one ((a) is obviously preferred): a) improve sapi/apache2filter/sapi_apache2.c to properly send application/x-httpd-source requests through the highlighter, b) update the README to reflect that source highlighting does not work with apxs2filter. Sub-items that should be addressed while I'm here: 1) PHP Bug 40499 should be closed as invalid; there is no "PHP-highlight" filter. I have no idea where the user got that idea. Not to mention, Set{Input,Output}Filter directives should not be used when --with-apxs2filter is used; all people need, truly, is AddType directives. Users/admins have to read the source to understand that fact. I wish this was made more apparent. https://bugs.php.net/bug.php?id=40499 2) There is no mention of --with-apxs2filter in the PHP configure flags documentation. It doesn't matter if the support is experimental -- it should be documented. http://www.php.net/manual/en/configure.about.php Test script: --------------- Not needed; see description. Expected result: ---------------- Users/administrators expect that when apxs2filter is used, per the README, that .phps documents should render as syntax highlighted. Actual result: -------------- .phps documents are actually executed/parsed as code.