ID: 40915 Updated by: [EMAIL PROTECTED] Reported By: trevor at corevx dot com -Status: Assigned +Status: Closed Bug Type: Strings related Operating System: Solaris / OS X PHP Version: 5.2.1 Assigned To: tony2001 New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. 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