summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmb@php.net>2015-09-07 23:02:56 +0200
committerChristoph M. Becker <cmb@php.net>2015-09-07 23:02:56 +0200
commit1372909429b2f54bdab80f9599c17ccf6e456f08 (patch)
tree5c9779d61d90160c5173a082d19dd705973ff4c5
parentf402056194180de488de1c990f089dce70aae6e6 (diff)
downloadphp-git-1372909429b2f54bdab80f9599c17ccf6e456f08.tar.gz
Fix #70453: IntlChar::foldCase() incorrect arguments and missing constants
We add missing ARG_INFO for the seconds parameter $options, and add the respective constants IntlChar::FOLD_CASE_DEFAULT and ::FOLD_CASE_EXCLUDE_SPECIAL_I.
-rw-r--r--ext/intl/uchar/tests/bug70453.phpt18
-rw-r--r--ext/intl/uchar/uchar.c3
2 files changed, 21 insertions, 0 deletions
diff --git a/ext/intl/uchar/tests/bug70453.phpt b/ext/intl/uchar/tests/bug70453.phpt
new file mode 100644
index 0000000000..4b3024e241
--- /dev/null
+++ b/ext/intl/uchar/tests/bug70453.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #70453 (IntlChar::foldCase() incorrect arguments and missing constants)
+--SKIPIF--
+<?php if (!extension_loaded('intl')) die("skip requires ext/intl") ?>
+--FILE--
+<?php
+$method = new ReflectionMethod('IntlChar', 'foldCase');
+$param = $method->getParameters()[1];
+var_dump($param->name, $param->isOptional(), $param->isPassedByReference());
+var_dump(IntlChar::foldCase('I', IntlChar::FOLD_CASE_DEFAULT));
+var_dump(IntlChar::foldCase('I', IntlChar::FOLD_CASE_EXCLUDE_SPECIAL_I));
+?>
+--EXPECT--
+string(7) "options"
+bool(true)
+bool(false)
+string(1) "i"
+string(2) "ı"
diff --git a/ext/intl/uchar/uchar.c b/ext/intl/uchar/uchar.c
index 0dbe9c9cf8..79eb8fda01 100644
--- a/ext/intl/uchar/uchar.c
+++ b/ext/intl/uchar/uchar.c
@@ -420,6 +420,7 @@ IC_METHOD(getPropertyValueEnum) {
/* {{{ proto int|string IntlChar::foldCase(int|string $char, int $options = IntlChar::FOLD_CASE_DEFAULT) */
ZEND_BEGIN_ARG_INFO_EX(foldCase_arginfo, 0, ZEND_RETURN_VALUE, 1)
ZEND_ARG_INFO(0, foldCase)
+ ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO();
IC_METHOD(foldCase) {
UChar32 cp, ret;
@@ -734,6 +735,8 @@ int php_uchar_minit(INIT_FUNC_ARGS) {
zend_declare_class_constant_string(ce, "UNICODE_VERSION", sizeof("UNICODE_VERISON")-1, U_UNICODE_VERSION);
IC_CONSTL("CODEPOINT_MIN", UCHAR_MIN_VALUE)
IC_CONSTL("CODEPOINT_MAX", UCHAR_MAX_VALUE)
+ IC_CONSTL("FOLD_CASE_DEFAULT", U_FOLD_CASE_DEFAULT)
+ IC_CONSTL("FOLD_CASE_EXCLUDE_SPECIAL_I", U_FOLD_CASE_EXCLUDE_SPECIAL_I)
/* All enums used by the uchar APIs. There are a LOT of them,
* so they're separated out into include files,