php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #14935 spaces NOT escaped by A..z
Submitted: 2002-01-08 15:24 UTC Modified: 2002-01-12 18:35 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: addcslashes at example dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.1.1 OS:
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: addcslashes at example dot com
New email:
PHP Version: OS:

 

 [2002-01-08 15:24 UTC] addcslashes at example dot com
http://www.php.net/manual/en/function.addcslashes.php
says `and space characters' but this is not true; on my
system
  addcslashes('foo[ ]','A..z')
results in
  \f\o\o\[ \]
not
  \f\o\o\[\ \]

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-09 21:09 UTC] irc-html@php.net
Confirmed, will fix in CVS.

Status -> Closed
 [2002-01-10 02:06 UTC] zak@php.net
We should probably take a closer look at this problem. I 
verified that addcslashes had the currently documented 
behaviour a while ago. If it has changed, we have a 
problem.

 [2002-01-10 19:00 UTC] elixer@php.net
The problem is that "space characters" in the example code is not meant to refer to specifically a space (ASCII 32) it is referring to tab, vertical tab, carriage return, line feed, etc.  Basically all of the [:space:] characters except for an actual ASCII 32 space.  This is expected behavior, you don't have to escape ASCII 32 in C strings.

The documentation fix is still lacking.  The line in the example code should read:

// All upper and lower-case letters will be escaped
// ... but so will the [\]^_` and any tabs, line
// feeds, carriage returns, etc.

Instead of the current (CVS):
// All upper and lower-case letters will be escaped
// ... but so will the [\]^_`

Or something along those lines.  I'll commit that later tonight unless someone objects or has better verbage.

 [2002-01-12 18:35 UTC] irc-html@php.net
Ok, fixed in CVS (again).  Current example (in CVS) reads:

echo addcslashes('foo[ ]', 'A..z');
// output:  \f\o\o\[ \]
// All upper and lower-case letters will be escaped
// ... but so will the [\]^_` and any tabs, line
// feeds, carriage returns, etc.

Status -> Closed (again)

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Sep 13 22:01:28 2024 UTC