]> granicus.if.org Git - php/commitdiff
Fix #70454: IntlChar::forDigit second parameter should be optional
authorChristoph M. Becker <cmb@php.net>
Mon, 7 Sep 2015 21:46:12 +0000 (23:46 +0200)
committerChristoph M. Becker <cmb@php.net>
Mon, 7 Sep 2015 21:46:12 +0000 (23:46 +0200)
ZPP expects "ll" instead of "l|l" what would match the "proto" and the
ARG_INFO.

ext/intl/uchar/tests/bug70454.phpt [new file with mode: 0644]
ext/intl/uchar/uchar.c

diff --git a/ext/intl/uchar/tests/bug70454.phpt b/ext/intl/uchar/tests/bug70454.phpt
new file mode 100644 (file)
index 0000000..351bb65
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Bug #70454 (IntlChar::forDigit second parameter should be optional)
+--SKIPIF--
+<?php if (!extension_loaded('intl')) die("skip requires ext/intl") ?>
+--FILE--
+<?php
+var_dump(IntlChar::forDigit(0));
+var_dump(IntlChar::forDigit(3));
+var_dump(IntlChar::forDigit(3, 10));
+var_dump(IntlChar::forDigit(10));
+var_dump(IntlChar::forDigit(10, 16));
+?>
+--EXPECT--
+int(48)
+int(51)
+int(51)
+int(0)
+int(97)
index 79eb8fda013ef6ca6173fd34443fc73c64e1d50f..243da122a203fafa0baa83b6d55eb9f8b6029b7f 100644 (file)
@@ -479,7 +479,7 @@ ZEND_END_ARG_INFO();
 IC_METHOD(forDigit) {
        zend_long digit, radix = 10;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &digit, &radix) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &digit, &radix) == FAILURE) {
                return;
        }