Home » PEAR » PEAR_Frontend_Web » Bug #1067
backslashes used as path separator on windows break the script index.php
Details
| Submitted | 2004-03-24 21:41 UTC |
|---|---|
| From | pear-dev at mocsnik dot hu |
| Status | Bogus |
| Package | PEAR_Frontend_Web |
| PHP Version | Irrelevant |
| OS | irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2004-03-24 21:41 UTC] pear-dev at mocsnik dot hu
Description:
------------
Parse error: parse error, unexpected T_STRING in c:\work\htdocs\webdoctor\includes\index.php on line 76
Reproduce code:
---------------
simply try to install PEAR using the frontend on windows
Expected result:
----------------
install works fine
Actual result:
--------------
index.php breaks with an error message:
Parse error: parse error, unexpected T_STRING in c:\work\htdocs\webdoki\includes\index.php on line 76
This happens because backslash is the path separator on windows and it just happens to be the escape character in strings too...
The auto-generated stuff (index.php lines 71-75):
if ($env=getenv('PHP_PEAR_PHP_BIN')) {
define("PHP_PEAR_PHP_BIN",$env);
} else {
putenv('PHP_PEAR_PHP_BIN=c:\work\htdocs\webdoctor\includes\');
}
should be:
putenv('PHP_PEAR_PHP_BIN=c:\work\htdocs\webdoctor\includes\\');
Remember, according to the php manual about single-quoted strings: "If a backslash needs to occur before a single quote or at the end of the string, you need to double it. Note that if you try to escape any other character, the backslash will also be printed! So usually there is no need to escape the backslash itself."
This probably appies to the other paths in this file also.
I was not the only one meeting with this bug, there was a guy some minutes ago on #PEAR:
<Teneberux> I get this :Parse error: parse error in d:\phpdev\www\1index.php on line 76
--
Dunno if the web installer is considered to be stable on windows, it seems there are no other problems using it anyway.. The bug above should be solved asap imho, because people even can't install PEAR with this version. They probably can, if they are lucky: if the paths don't end with a backslash, there's no error report:
('PHP_PEAR_PHP_BIN=c:\work\htdocs\webdoctor\includes');
[2004-03-30 01:10 UTC] pear-dev at mocsnik dot hu
yes, it's v0.3
[2004-05-31 17:05 UTC] pierre at dotgeek dot org
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the existing bug instead.
Thank you for your interest in PEAR.
See #815