Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.4.3

Request #9129 XHTML pages being parsed as PHP
Submitted: 2006-10-21 21:09 UTC Modified: 2007-11-12 20:34 UTC
From: pear at lehi dot ath dot cx Assigned:
Status: Open Package: PhpDocumentor (version 1.3.0)
PHP Version: 5.1.6 OS: FC5
Roadmaps: 2.0.0a1    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: pear at lehi dot ath dot cx
New email:
PHP Version: Package Version: OS:

 

 [2006-10-21 21:09 UTC] pear at lehi dot ath dot cx (James)
Description: ------------ I just installed PHPDocumentor 1.3.0RC6 by following the INSTALL instructions. Everything seems to function properly, except when I try to view documentation on individual files. I believe the problem is because the pages being generated are xhtml pages and have the <?xml version="1.0" encoding="iso-8859-1"?> at the beginning of the document. I know this is causing the problem because removing that first line makes the page come up just fine. Even though the page is just html, apache is interpreting it as php because it is called something like _filename.php.html. I think a possible solution would be to rename the file to something like _filename_php.html so that the web server doesn't get confused what file type it is. I tried renaming the files and they load properly, but of course they aren't linked anymore. Turning off short_open_tags in php.ini would also fix this problem, but most of my code uses short_open_tags, so it would break more than it would fix if I changed it. Expected result: ---------------- Pages that don't contain a parse error. Actual result: -------------- Documentation for individual pages produce a parse error. These pages have a filename of the following format: _filename.php.html

Comments

 [2006-10-21 21:12 UTC] pear at lehi dot ath dot cx
Description: ------------ I just installed PHPDocumentor 1.3.0RC6 by following the INSTALL instructions. Everything seems to function properly, except when I try to view documentation on individual files. I believe the problem is because the pages being generated are xhtml pages and have the <?xml version="1.0" encoding="iso-8859-1"?> at the beginning of the document. I know this is causing the problem because removing that first line makes the page come up just fine. Even though the page is just html, apache is interpreting it as php because it is called something like _filename.php.html. I think a possible solution would be to rename the file to something like _filename_php.html so that the web server doesn't get confused what file type it is. I tried renaming the files and they load properly, but of course they aren't linked anymore. Turning off short_open_tags in php.ini would also fix this problem, but most of my code uses short_open_tags, so it would break more than it would fix if I changed it. Expected result: ---------------- Pages that don't contain a parse error. Actual result: -------------- Documentation for individual pages produce a parse error. These pages have a filename of the following format: _filename.php.html
 [2006-10-22 00:24 UTC] cellog (Greg Beaver)
your server is set to parse <? as PHP tags, and also to parse html files as PHP format. Please turn off short_open_tags, or set the serevr to parse only .php as php files and the problem with go away. This is not a phpDocumentor problem
 [2006-10-22 14:09 UTC] pear at lehi dot ath dot cx
If anyone runs into this problem, you can just add a .htaccess file with the following directive to fix it. The file belongs in the same folder where the documentation is being generated. php_flag short_open_tag Off This file will then allow you to keep the rest of your code using the short_open_tag but selectively change it for just the documentation.
 [2007-09-14 09:58 UTC] jmvw (Michiel Mylastnamebeginswithalowercaseletter van Wessem)
That is a workaround, not a fix. The file is still run through the PHP interpreter, while it shouldn't. Apache will interpret files with .php. anywhere in their name. See also http://httpd.apache.org/docs/2.2/mod/mod_mime.html#multipleext Since Apache is the most common environment for PHP, this is a bug in PHP Documentor.
 [2007-09-14 10:21 UTC] ashnazg (Chuck Burgess)
Perhaps this is something that PhpDocumentor could understand is an external constraint and plan around. I'll look at whether or not I can rename the generated files to use the text "-dot-" in place of "." in documentation filenames, since it seems that trying to preserve the parsed file's filename inside the generated doc's filename is the culprit here.
 [2008-03-01 14:55 UTC] albertlash (Albert Lash)
Common subdirectories: phpdoc_original/phpDocumentor/Converters and phpdoc_new/phpDocumentor/Converters diff -ud phpdoc_original/phpDocumentor/Parser.inc phpdoc_new/phpDocumentor/Parser.inc --- phpdoc_original/phpDocumentor/Parser.inc 2008-03-01 14:45:21.000000000 -0500 +++ phpdoc_new/phpDocumentor/Parser.inc 2008-03-01 14:38:42.000000000 -0500 @@ -556,6 +556,7 @@ $name = str_replace( ':', '', dirname($path) . PATH_DELIMITER . $page->getFile() ); $tmp = explode( PATH_DELIMITER, $name ); $name = implode( "---", array_slice( $tmp, $base ) ); + $name = str_replace('.php','-dot-php',$name); // if base is '', drive letter is present in windows $page->setName($name); diff -ud phpdoc_original/phpDocumentor/phpDocumentorTParser.inc phpdoc_new/phpDocumentor/phpDocumentorTParser.inc --- phpdoc_original/phpDocumentor/phpDocumentorTParser.inc 2008-03-01 14:45:15.000000000 -0500 +++ phpdoc_new/phpDocumentor/phpDocumentorTParser.inc 2008-03-01 14:41:42.000000000 -0500 @@ -251,6 +251,7 @@ . PATH_DELIMITER . $page->getFile()); $tmp = explode(PATH_DELIMITER, $name); $name = implode("---", array_slice($tmp, $base)); + $name = str_replace('.php','-dot-php',$name); // if base is '', drive letter is present in windows $page->setName($name); Common subdirectories: phpdoc_original/phpDocumentor/Smarty-2.6.0 and phpdoc_new/phpDocumentor/Smarty-2.6.0