"the" in heredoc makes script "not found"
Posted: Fri Jan 12, 2007 10:55 pm
I'm in the process of moving some code over to a new server and came across this very obscure bug/feature.
I'm wondering if anybody can reproduce it, it's so odd.
Essentially: a php script cannot be found by Apache if it contains the word "the" in a heredoc (when using a script name without an extension, and a defaulttype of php).
First of all, this is with Apache 2.2.2 and PHP 5.2.0 on Linux (Fedora) ONLY. This DOES NOT happen with earlier versions (my scripts run fine on older servers).
I've set the default type to php in httpd.conf for this virtual server:
There are no rewrites set for this server.
I create a file called "test" (no extension) that contains:
Now, if I access the file "/test/" through the server Apache tells me "not found".
If I omit the trailing slash, I'm shown the source of the file (i.e. Apache can find it now, but doesn't execute it).
If I change the word in the heredoc to anything other than "the", the php is executed correctly! Even putting text each side of the "the" makes no difference, still fails (I initially found the problem in a full page of text).
Just changing "the" to "them" fixes it. Also, if the script has a .php extension it is always found and executed, this only happens with the defaulttype. I've also typed the code in manually on the server to make sure it's not a line-endings problem.
On another script, again the word "the" is the problem, but for that one it's in a standard echoed string, not a heredoc, which is even stranger.
Any ideas what could have changed to break this type of usage in these latest versions? Is it reproducable?
I'm stuck on what to do about it, other than replace the "e" in "the" with it's html character code!
I'm wondering if anybody can reproduce it, it's so odd.
Essentially: a php script cannot be found by Apache if it contains the word "the" in a heredoc (when using a script name without an extension, and a defaulttype of php).
First of all, this is with Apache 2.2.2 and PHP 5.2.0 on Linux (Fedora) ONLY. This DOES NOT happen with earlier versions (my scripts run fine on older servers).
I've set the default type to php in httpd.conf for this virtual server:
Code: Select all
DefaultType application/x-httpd-phpI create a file called "test" (no extension) that contains:
Code: Select all
<?php
echo <<<EOT
the
EOT;
?>If I omit the trailing slash, I'm shown the source of the file (i.e. Apache can find it now, but doesn't execute it).
If I change the word in the heredoc to anything other than "the", the php is executed correctly! Even putting text each side of the "the" makes no difference, still fails (I initially found the problem in a full page of text).
Just changing "the" to "them" fixes it. Also, if the script has a .php extension it is always found and executed, this only happens with the defaulttype. I've also typed the code in manually on the server to make sure it's not a line-endings problem.
On another script, again the word "the" is the problem, but for that one it's in a standard echoed string, not a heredoc, which is even stranger.
Any ideas what could have changed to break this type of usage in these latest versions? Is it reproducable?
I'm stuck on what to do about it, other than replace the "e" in "the" with it's html character code!