summaryrefslogtreecommitdiff
path: root/Zend/zend_API.c
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-02-16 16:41:43 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2020-02-16 16:48:35 +0100
commit6ee6097688a8c64e0e0ba166d48b16a93bf107a2 (patch)
tree9157214fbb184a14da756c195897ccf40e441d85 /Zend/zend_API.c
parentd9b80efb57ad46a5ba80581d823957471bfe4db0 (diff)
downloadphp-git-6ee6097688a8c64e0e0ba166d48b16a93bf107a2.tar.gz
Constrain number parameter of numfmt_format to int|float
This is inline with similar changes to the math functions. Especially, array to number conversion makes no sense here, and is likely to hide a programming error. To make that feasible, we introduce the `n` specifier for classic ZPP so we can stick with `zend_parse_method_parameters()`. We also remove a test case, which has been degenerated to a ZPP test.
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r--Zend/zend_API.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index a3e452bf7d..ed8440f104 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -522,6 +522,16 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
}
break;
+ case 'n':
+ {
+ zval **p = va_arg(*va, zval **);
+
+ if (!zend_parse_arg_number(arg, p, check_null)) {
+ return "number";
+ }
+ }
+ break;
+
case 's':
{
char **p = va_arg(*va, char **);
@@ -793,7 +803,7 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
case 'f': case 'A':
case 'H': case 'p':
case 'S': case 'P':
- case 'L':
+ case 'L': case 'n':
max_num_args++;
break;