PHP 4.0 Bug #5387: Here files and backslash failures
| From: | claw at kanga dot nu | Date: | Wed, 05 Jul 2000 18:49:38 +0000 |
| Subject: | PHP 4.0 Bug #5387: Here files and backslash failures | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-23493@lists.php.net to get a copy of this message | ||
From: claw@kanga.nu
Operating system: Linux (Debian woody)
PHP version: 4.0.1pl2
PHP Bug Type: Scripting Engine problem
Bug description: Here files and backslash failures
I use here files in string assignments heavily (the majority of my
PHP pages are automatically generated by scripts). I use here files
specifically as I can't control what characters might be used in
those strings (eg quotes, etc).
Example:
$var1 = <<< END_VAR
This is a string
END_VAR;
The problem enters for some instances of backslashes in the here file:
$var2 = <<< END_VAR
...
/(o__. _____| \ |OcO|
---------/|-/|-( ,__)-------| | |--------+++++++++/|_| - |_ -----------
/\/ |/ |/ _ \++++++C+O+M+P+L|E+X+I+T+Y+++++O+F+++/f| `-' |
|\/ / \/ "++++++D+|+S+T+R+I+B+U+T+E+D+( u| |
___| . .____. /______________| "|++++++S+Y+S+T+E+M+S+\n|_)___(_/-----------
_| /| |_ || |_ |____| | "++++++++\| | | | \
/__/LL__,) LL__,) | / (__|__) \
...
END_VAR;
This generates the following warning:
Warning: Unexpected character in input: '\' (ASCII=92) state=5 in
/long/path/here/file.php on line 1552
Most interestingly it doesn't generate a warning for every backslash
character. In the above example is misses the first several
backslashes and generates a warning on only the strings "\|" and
"\<nl>" where <nl> is an LF (bottom of the man's shield and end of
his sword).
I'm running PHP4 v4.0.1-2.