php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #46054 comment of addcslashes 'A..z' is wrong
Submitted: 2008-09-11 15:38 UTC Modified: 2008-11-04 16:55 UTC
From: miau dot jp at gmail dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Windows
Private report: No CVE-ID: None
 [2008-09-11 15:38 UTC] miau dot jp at gmail dot com
Description:
------------
http://php.net/manual/en/function.addcslashes.php

says 'A..z' escapes any tabs, line feeds, carriage
retuns. But 'A..z' escapes just upper and lower-case
letters and the [\]^_`.





Reproduce code:
---------------
<?php
for ($n = 0x00; $n < 0x80; $n++) {
    $c = chr($n);
    $escaped = addcslashes($c, 'A..z');
    if (strlen($escaped) == 2) {
        print ($n < 0x20 ? $escaped : $c);
    }
}
?>

Expected result:
----------------
\t\n\v\f\rABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz

Actual result:
--------------
ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-02 17:14 UTC] danbrown@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 [2008-11-03 19:22 UTC] miau dot jp at gmail dot com
Exactly. This is not a bug but a documentation problem.

http://php.net/manual/en/function.addcslashes.php

says ...

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

I think it should be ...

// All upper and lower-case letters will be escaped
// ... but so will the [\]^_`.
 [2008-11-04 16:55 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

"All upper and lower-case letters will be escaped ... but so will the [\]^_`."
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 11:01:30 2024 UTC