mirror of
https://github.com/php/php-src.git
synced 2024-10-01 06:46:08 +00:00
dbc5b42435
Made pack() with "Z" force NUL termination, even if it mean truncating input to less than the number of characters specified and if the number of characters is "*", the output will be one byte larger than the input. Improved tests.
26 lines
357 B
PHP
26 lines
357 B
PHP
--TEST--
|
|
pack()/unpack(): "A" modifier
|
|
--FILE--
|
|
<?php
|
|
var_dump(
|
|
pack("A5", "foo "),
|
|
pack("A4", "fooo"),
|
|
pack("A4", "foo"),
|
|
unpack("A*", "foo\0\rbar\0 \t\r\n"),
|
|
unpack("A4", "foo\0\rbar\0 \t\r\n")
|
|
);
|
|
?>
|
|
--EXPECTF--
|
|
string(5) "foo "
|
|
string(4) "fooo"
|
|
string(4) "foo "
|
|
array(1) {
|
|
[1]=>
|
|
string(8) "foo%c%cbar"
|
|
}
|
|
array(1) {
|
|
[1]=>
|
|
string(3) "foo"
|
|
}
|
|
|