#23984 [Opn->Bgs]: chr(0) in string causes string truncation
| From: | philip@php.net | Date: | Tue, 03 Jun 2003 15:09:07 +0000 |
| Subject: | #23984 [Opn->Bgs]: chr(0) in string causes string truncation | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-41033@lists.php.net to get a copy of this message | ||
ID: 23984
Updated by: philip@php.net
Reported By: ltfrench at vt dot edu
-Status: Open
+Status: Bogus
Bug Type: Strings related
Operating System: Redhat 8.0
PHP Version: 4.3.1
New Comment:
PHP is looking for a variable named $nullwithnull so to make this work,
you must use "string{$null}withnull"...
Previous Comments:
------------------------------------------------------------------------
[2003-06-03 08:56:54] ltfrench at vt dot edu
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 this bug report at http://bugs.php.net/?id=23984&edit=1