From:             ltfrench at vt dot edu
Operating system: Redhat 8.0
PHP version:      4.3.1
PHP Bug Type:     Strings related
Bug description:  chr(0) in string causes string truncation

This problem is very similar to: http://bugs.php.net/bug.php?id=14580 and
also http://bugs.php.net/bug.php?id=18341 but seems to have cropped up
again.

Inserting a null character into a string with the chr() function causes
the string to be truncated.

<?php
$null = chr(0);
$a = "string\0withnull";
$b = "string$nullwithnull";

echo $a . "\n";
echo $b . "\n";

echo strlen($a) . "\n";
echo strlen($b) . "\n";
?>

Output:
stringwithnull
string
15
6

I encountered this with a generic php 4.3.1 setup.
-- 
Edit bug report at http://bugs.php.net/?id=23984&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=23984&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=23984&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=23984&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=23984&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=23984&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=23984&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=23984&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=23984&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=23984&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=23984&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23984&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=23984&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=23984&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=23984&r=gnused

Reply via email to