|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: philip at qs dot co dot nz
New email:
PHP Version: OS:


 [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