mirror of
https://github.com/php/php-src.git
synced 2024-10-01 23:06:11 +00:00
Merge branch 'PHP-5.5'
* PHP-5.5: Fixed Bug #63738 unpack: back result with Z format
This commit is contained in:
commit
261995e02a
@ -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;
|
||||
}
|
||||
|
@ -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"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user