PHP 4.0 Bug #9168: unpack 'h' and 'H' formats don't work
| From: | rusty at socrates dot berkeley dot edu | Date: | Wed, 07 Feb 2001 23:56:39 +0000 |
| Subject: | PHP 4.0 Bug #9168: unpack 'h' and 'H' formats don't work | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-46003@lists.php.net to get a copy of this message | ||
From: rusty@socrates.berkeley.edu
Operating system: solaris 7
PHP version: 4.0.4pl1
PHP Bug Type: Strings related
Bug description: unpack 'h' and 'H' formats don't work
In the following sample the variable "encoded" is zero length; an empty string. If I
change the format chars from H and h to C then it does get stuff.
<script language="php">
// 0xFF * 0xEE
$ch = 60690;
$encoded = "";
$hexn = unpack("Hz", $ch); // high nibble
if (isset($hexn["z"]))
$encoded .= $hexn["z"];
else
$encoded .= "-";
$hexn = unpack("hz", $ch); // low nibble
if (isset($hexn["z"]))
$encoded .= $hexn["z"];
else
$encoded .= "-";
echo $encoded . "<br>";
echo strlen($encoded) . "<br>";
</script>
--
Edit Bug report at: http://bugs.php.net/?id=9168&edit=1