PHP 4.0 Bug #10133: Some values returned by gmp_strval are null-terminated
| From: | chr at tv2i dot dk | Date: | Tue, 03 Apr 2001 11:13:01 +0000 |
| Subject: | PHP 4.0 Bug #10133: Some values returned by gmp_strval are null-terminated | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-50668@lists.php.net to get a copy of this message | ||
From: chr@tv2i.dk
Operating system: Linux 2.2.16-3
PHP version: 4.0.4pl1
PHP Bug Type: *Math Functions
Bug description: Some values returned by gmp_strval are null-terminated
Some values returned by gmp_strval are padded with an additional \0 byte.
The code
for ($i = 0; $i < 20; $i++) {
$n = gmp_init($i);
$ns = gmp_strval($n);
print ord(substr($ns, -1)) . ' ';
}
outputs
48 49 50 51 52 53 54 55 0 0 48 49 50 51 52 53 54 55 56 57
where I would expect
48 49 50 51 52 53 54 55 56 57 48 49 50 51 52 53 54 55 56 57
This behavior is reproducible.
--
Edit Bug report at: http://bugs.php.net/?id=10133&edit=1