Switch to * instead of + in zpp.
This commit is contained in:
Nikita Popov 2015-09-14 15:03:51 +02:00
parent 669f0b39b1
commit ab74d80247
3 changed files with 13 additions and 2 deletions

1
NEWS
View File

@ -41,6 +41,7 @@ PHP NEWS
- Standard:
. Implemented the RFC `Random Functions Throwing Exceptions in PHP 7`.
(Sammy Kaye Powers, Anthony)
. Fixed bug #70487 (pack('x') produces an error). (Nikita)
- Streams:
. Fixed bug #70361 (HTTP stream wrapper doesn't close keep-alive connections).

View File

@ -112,7 +112,7 @@ static void php_pack(zval *val, size_t size, int *map, char *output)
PHP_FUNCTION(pack)
{
zval *argv = NULL;
int num_args, i;
int num_args = 0, i;
int currentarg;
char *format;
size_t formatlen;
@ -122,7 +122,7 @@ PHP_FUNCTION(pack)
int outputpos = 0, outputsize = 0;
zend_string *output;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s+", &format, &formatlen, &argv, &num_args) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s*", &format, &formatlen, &argv, &num_args) == FAILURE) {
return;
}

View File

@ -0,0 +1,10 @@
--TEST--
Bug #70487: pack('x') produces an error
--FILE--
<?php
var_dump(pack('x') === "\0");
?>
--EXPECT--
bool(true)