com php-src: Fix #70454: IntlChar::forDigit second parameter should be optional: ext/intl/uchar/tests/bug70454.phpt ext/intl/uchar/uchar.c
| From: | Christoph Michael Becker | Date: | Mon, 07 Sep 2015 21:46:12 +0000 |
| Subject: | com php-src: Fix #70454: IntlChar::forDigit second parameter should be optional: ext/intl/uchar/tests/bug70454.phpt ext/intl/uchar/uchar.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88951@lists.php.net to get a copy of this message | ||
Commit: 1c902e2e630a6ed61983804994a4e312853008b4
Author: Christoph M. Becker <cmb@php.net> Mon, 7 Sep 2015 23:46:12 +0200
Parents: 34c17558429bdf6b5563c56d3fa6093f6bdcbf6c
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1c902e2e630a6ed61983804994a4e312853008b4
Log:
Fix #70454: IntlChar::forDigit second parameter should be optional
ZPP expects "ll" instead of "l|l" what would match the "proto" and the
ARG_INFO.
Bugs:
https://bugs.php.net/70454
Changed paths:
A ext/intl/uchar/tests/bug70454.phpt
M ext/intl/uchar/uchar.c
Diff:
diff --git a/ext/intl/uchar/tests/bug70454.phpt b/ext/intl/uchar/tests/bug70454.phpt
new file mode 100644
index 0000000..351bb65
--- /dev/null
+++ b/ext/intl/uchar/tests/bug70454.phpt
@@ -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)
diff --git a/ext/intl/uchar/uchar.c b/ext/intl/uchar/uchar.c
index 79eb8fd..243da12 100644
--- a/ext/intl/uchar/uchar.c
+++ b/ext/intl/uchar/uchar.c
@@ -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;
}