|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #185 fputs puts wrong count when Backslash in string
Submitted: 1998-03-18 00:55 UTC Modified: 1998-03-28 14:32 UTC
From: philip at qs dot co dot nz Assigned:
Status: Closed Package: Other
PHP Version: 3.0b6 OS: Linx-ELF i586
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
36 + 12 = ?
Subscribe to this entry?

 [1998-03-18 00:55 UTC] philip at qs dot co dot nz
If a backslash is in a string to fputs, then fputs adds an extra character
to the output stream for every backslash

for example:
  $fp = fopen("out","w+");

File out contains:

   61 62 63 5c 64 65 66 00
   a   b  c  \  d  e  f nul

The same result will be given for the string "abc\\def".


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1998-03-28 14:32 UTC] jim
This is the correct behavior. As noted in the ChangeLog for 3.0b4, "\Z" (where Z
is not one of the usual escape characters) leaves the backslash intact (and generates
an error message at the E_NOTICE level, which isn't usually printed). Putting in a
double backslash simply escapes the backslash and gives the same output.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Feb 01 19:03:58 2023 UTC