From 1372909429b2f54bdab80f9599c17ccf6e456f08 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 7 Sep 2015 23:02:56 +0200 Subject: [PATCH] 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. --- ext/intl/uchar/tests/bug70453.phpt | 18 ++++++++++++++++++ ext/intl/uchar/uchar.c | 3 +++ 2 files changed, 21 insertions(+) create mode 100644 ext/intl/uchar/tests/bug70453.phpt 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-- + +--FILE-- +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, -- 2.40.0