php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5387 Here files and backslash failures
Submitted: 2000-07-05 20:49 UTC Modified: 2000-07-07 18:48 UTC
From: claw at kanga dot nu Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.1pl2 OS: Linux (Debian woody)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: claw at kanga dot nu
New email:
PHP Version: OS:

 

 [2000-07-05 20:49 UTC] claw at kanga dot nu
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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-07 09:20 UTC] stas at cvs dot php dot net
PHP does not understand \\n correctly. Needs to be fixed.
 [2000-07-07 18:48 UTC] stas at cvs dot php dot net
Fixed in CVS
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jun 19 23:01:32 2025 UTC