[PHP-DEV] PHP 4.0 Bug #6361: unpack fails with 'H' From: alex <email protected>
Date: 08/25/00

From: alex <email protected>
Operating system: RH Linux 6.0
PHP version: 4.0.1pl2
PHP Bug Type: Misbehaving function
Bug description: unpack fails with 'H'

This script fails complaining about there isn't enougth data for unpack:

$md5_val = '0123456789abcdef0123456789abcdef';
print "{$md5_val}<br>\n";
$binary_md5 = pack('H32', $md5_val);

$md5_val = unpack('H32a', $binary_md5);
$md5_val = $md5_val['a'];
print "{$md5_val}<br>\n";

It's corresponding perl scripts works fine:

#!/usr/bin/perl
$md5_val = '0123456789abcdef0123456789abcdef';
print "$md5_val\n";
$binary_md5 = pack('H32', $md5_val);

($md5_val) = unpack('H32', $binary_md5);
print "$md5_val\n";

Workarround:

$md5_val = unpack('H32a', $binary_md5.$binary_md5);

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>