Bug #14684 Updated: pack doesn't correctly handle zero integer values
| From: | mfischer@php.net | Date: | Mon, 24 Dec 2001 10:48:42 +0000 |
| Subject: | Bug #14684 Updated: pack doesn't correctly handle zero integer values | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-74908@lists.php.net to get a copy of this message | ||
ID: 14684
Updated by: mfischer
Reported By: someone@records.ru
Old Status: Open
Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Linux 2.2.18
PHP Version: 4.1.0
New Comment:
There's nothing wrong with pack, neither CGI nor apache. I guess your client can't handle
this.
You can verify this youself with:
<?
$foo = pack('L', 0);
$f = fopen('/tmp/pack', 'wb');
fwrite($f, $foo);
fclose($f);
?>
$ hexdump /tmp/pack
0000000 0000 0000
0000004
As you can see, it's perfectly valid (tested with apache, mod_php).
Previous Comments:
------------------------------------------------------------------------
[2001-12-24 05:34:20] someone@records.ru
I've just compiled CGI version, it works fine, output is "\x00\x00\x00\x00".
Also here's my configure string from phpinfo:
'./configure' '--with-apxs=/www/bin/apxs' '--with-mod_charset'
'--without-pear' '--with-zlib' '--with-bz2'
'--with-mysql=/usr' '--disable-xml'
make CFLAGS="-DHAVE_MYSQL_MYSQL_H -I/www/include"
------------------------------------------------------------------------
[2001-12-24 05:09:46] someone@records.ru
<?= pack("L",0); ?>
On PHP 4.1.0, compiled as Apache shared module outputs string "\x20\x20\x20\x20" (4
spaces). It is not "L"-specific issue. <?= pack("C",0); ?> also outputs
"\x20".
Any non-zero values are processed OK.
PHP 4.0.1pl2 and 4.0.6 seems to work correctly.
Configuration includes --with-apxs, --with-mysql (bundled), --with-bz2, --without-xml and
--without-pear.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14684&edit=1