com php-src: Fix bug #70487: NEWS ext/standard/pack.c ext/standard/tests/strings/bug70487.phpt

From: Date: Mon, 14 Sep 2015 13:04:43 +0000
Subject: com php-src: Fix bug #70487: NEWS ext/standard/pack.c ext/standard/tests/strings/bug70487.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-89015@lists.php.net to get a copy of this message
Commit: ab74d802473c10c9f9a61f75ba6443de9a958e4b Author: Nikita Popov <nikic@php.net> Mon, 14 Sep 2015 15:03:51 +0200 Parents: 669f0b39b184593e01e677360fd79b2b63058ca0 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ab74d802473c10c9f9a61f75ba6443de9a958e4b Log: Fix bug #70487 Switch to * instead of + in zpp. Bugs: https://bugs.php.net/70487 Changed paths: M NEWS M ext/standard/pack.c A ext/standard/tests/strings/bug70487.phpt Diff: diff --git a/NEWS b/NEWS index 15caf3c..2dcb13e 100644 --- a/NEWS +++ b/NEWS @@ -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). diff --git a/ext/standard/pack.c b/ext/standard/pack.c index 8b41038..f044ab5 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -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; } diff --git a/ext/standard/tests/strings/bug70487.phpt b/ext/standard/tests/strings/bug70487.phpt new file mode 100644 index 0000000..e4ca1ff --- /dev/null +++ b/ext/standard/tests/strings/bug70487.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #70487: pack('x') produces an error +--FILE-- +<?php + +var_dump(pack('x') === "\0"); + +?> +--EXPECT-- +bool(true)

« previous php.cvs (#89015) next »