#28683 [Opn->Csd]: addcslashes ASCII character conversion octal range invalid
| From: | dave@php.net | Date: | Fri, 06 Aug 2004 15:00:13 +0000 |
| Subject: | #28683 [Opn->Csd]: addcslashes ASCII character conversion octal range invalid | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969362755@lists.php.net to get a copy of this message | ||
ID: 28683
Updated by: dave@php.net
Reported By: todd at magnifisites dot com
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: RH Linux/Windows XP
PHP Version: 4.3.6
New Comment:
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.
I only saw one error in the documentation and have fixed it. Remember
that octal representation is base 8, not base 10. \36 is not the '$'
character, it is ASCII character 30, which is why your expected result
and all its \<digits> are wrong.
Previous Comments:
------------------------------------------------------------------------
[2004-06-07 21:53:51] todd at magnifisites dot com
Description:
------------
The addcslashes manual page states that characters with ASCII code
lower than 32 and higher than 126 are converted to octal
representation. It then instructs us to use the ord() function to find
the ASCII value for a character. I have found discrepancies in my tests
(I've tested on both Linux and Windows servers). The octal
representation conversion seems to occur completely throughout the
range including 32 through 126, inclusive, rather than outside that
range.
Reproduce code:
---------------
$null = NULL;
$var = "Hi there\" dollar $ amper \t sand & and single ' quote NULL
$null";
$escaped_var = addcslashes($var, "\0\9\34\36\38\39");
print $escaped_var;
Expected result:
----------------
Hi there\" dollar \$ amper \t sand \& and single \' quote NULL
Actual result:
--------------
Hi there" dollar $ amper sand & and single ' quote NULL
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28683&edit=1