ID:               40915
 Updated by:       [EMAIL PROTECTED]
 Reported By:      trevor at corevx dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         Strings related
 Operating System: Solaris / OS X
 PHP Version:      5.2.1
-Assigned To:      
+Assigned To:      tony2001


Previous Comments:
------------------------------------------------------------------------

[2007-03-26 06:06:03] trevor at corevx dot com

Description:
------------
When the input to addcslashes contains a NULL character (string
terminator, \000) the resulting output is terminated at that point if
the NULL character is not deliberately escaped.  

This makes it impossible to use addcslashes for certain special cases
with binary data.  If fixed it would be a much more powerful tool.

Reproduce code:
---------------
# Last pair demonstrates issue

$str = "a\000z";

echo $str;                                # => az
strlen( $str );                           # => 3

addslashes( $str );                       # => a\0z
strlen( addslashes( $str ) );             # => 4

addcslashes( $str, "\000z" );             # => a\000\z
strlen( addcslashes( $str, "\000z" ) );   # => 7

addcslashes( $str, "z" );                 # => a
strlen( addcslashes( $str, "z" ) );       # => 1

Expected result:
----------------
echo addcslashes( $str, "z" );            # => a\z
strlen( addcslashes( $str, "z" ) );       # => 4



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=40915&edit=1

Reply via email to