summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/bug61038.phpt
blob: 7130804fa415c03afb14aa273ee6dc0ebdf5bd33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--TEST--
Bug #61038: unpack("a5", "str\0\0") does not work as expected
--FILE--
<?php
var_dump(unpack("a4", "str\0\0"));
var_dump(unpack("a5", "str\0\0"));
var_dump(unpack("a6", "str\0\0"));
var_dump(unpack("a*", "str\0\0"));
?>
--EXPECTF--
array(1) {
  [1]=>
  string(4) "str%c"
}
array(1) {
  [1]=>
  string(5) "str%c%c"
}

Warning: unpack(): Type a: not enough input, need 6, have 5 in %s on line %d
bool(false)
array(1) {
  [1]=>
  string(5) "str%c%c"
}