Merge branch 'PHP-5.5'

* PHP-5.5:
  Fixed Bug #63738 unpack: back result with Z format
This commit is contained in:
Remi Collet 2012-12-11 16:34:51 +01:00
commit 261995e02a
2 changed files with 25 additions and 3 deletions

View File

@ -729,8 +729,7 @@ PHP_FUNCTION(unpack)
size = len;
/* Remove everything after the first null */
s = 0;
while (s++ <= len) {
for (s=0 ; s < len ; s++) {
if (input[inputpos + s] == pad)
break;
}

View File

@ -9,9 +9,15 @@ var_dump(
pack("Z4", "foo"),
pack("Z*", "foo"),
unpack("Z*", "foo\0\rbar\0 \t\r\n"),
unpack("Z9", "foo\0\rbar\0 \t\r\n")
unpack("Z9", "foo\0\rbar\0 \t\r\n"),
unpack("Z2", "\0"),
unpack("Z2", "\0\0"),
unpack("Z2", "A\0"),
unpack("Z2", "AB\0"),
unpack("Z2", "ABC")
);
--EXPECTF--
Warning: unpack(): Type Z: not enough input, need 2, have 1 in %s on line %d
string(0) ""
string(5) "foo%c%c"
string(4) "foo%c"
@ -25,3 +31,20 @@ array(1) {
[1]=>
string(3) "foo"
}
bool(false)
array(1) {
[1]=>
string(0) ""
}
array(1) {
[1]=>
string(1) "A"
}
array(1) {
[1]=>
string(2) "AB"
}
array(1) {
[1]=>
string(2) "AB"
}