Re: PHP 4.0 Bug #5448 Updated: Backslashes in here files not happy

From: Date: Thu, 06 Jul 2000 23:31:02 +0000
Subject: Re: PHP 4.0 Bug #5448 Updated: Backslashes in here files not happy
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-23759@lists.php.net to get a copy of this message
On 7 Jul 2000 23:16:40 -0000 Bug Database <php-dev@lists.php.net> wrote: > ID: 5448 Updated by: andi Reported By: claw@kanga.nu Status: > Closed Bug Type: Scripting Engine problem Assigned To: Comments: > You need to escape backslahes in here-docs (\\) Whoa! Why? That seems backwards. If PHP is going to interpret here files you need to provide an option that allows them to be read as-is. In many cases we don't have control over the contents of a here file (I don't in this case), just its placement within the PHP file. Ergo, if that here file happens to contain backslashes you're screwed. Bash takes a useful approach that you may wish to emulate. Quoting from the manpage: --<cut>-- The format of here-documents is as follows: <<[-]word here-document delimiter No parameter expansion, command substitution, arithmetic expansion, or pathname expansion is performed on word. If any characters in word are quoted, the delimiter is the result of quote removal on word, and the lines in the here-document are not expanded. If word is unquoted, all lines of the here-document are subjected to parameter expansion, command substitution, and arithmetic expansion. In the latter case, the character sequence \<newline> is ignored, and \ must be used to quote the characters \, $, and `. If the redirection operator is <<-, then all leading tab characters are stripped from input lines and the line containing delimiter. This allows here-documents within shell scripts to be indented in a natural fashion. --<cut>-- -- "Finally coming home" Home: claw@kanga.nu J C Lawrence Other: coder@kanga.nu ----------(*) Keys etc: finger claw@kanga.nu --=| A man is as sane as he is dangerous to his environment |=--

« previous php.dev (#23759) next »