php-src/ext/standard/tests/strings/bug36148.phpt
2006-01-26 15:45:33 +00:00

30 lines
461 B
PHP

--TEST--
Bug #36148 (unpack("H*hex", $data) is adding an extra character to the end of the string)
--FILE--
<?php
$values = array("a", "aa", "aaa", "aaaa");
foreach ($values as $value) {
$a = pack("H*", $value);
$b = unpack("H*", $a);
echo $value.": ";
var_dump($b);
}
?>
--EXPECT--
a: array(1) {
[1]=>
string(2) "a0"
}
aa: array(1) {
[1]=>
string(2) "aa"
}
aaa: array(1) {
[1]=>
string(4) "aaa0"
}
aaaa: array(1) {
[1]=>
string(4) "aaaa"
}