]> granicus.if.org Git - php/commitdiff
Fix #70453: IntlChar::foldCase() incorrect arguments and missing constants
authorChristoph M. Becker <cmb@php.net>
Mon, 7 Sep 2015 21:02:56 +0000 (23:02 +0200)
committerChristoph M. Becker <cmb@php.net>
Mon, 7 Sep 2015 21:02:56 +0000 (23:02 +0200)
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 [new file with mode: 0644]
ext/intl/uchar/uchar.c

diff --git a/ext/intl/uchar/tests/bug70453.phpt b/ext/intl/uchar/tests/bug70453.phpt
new file mode 100644 (file)
index 0000000..4b3024e
--- /dev/null
@@ -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) "ı"
index 0dbe9c9cf89ebb152b57344772447c82b510613f..79eb8fda013ef6ca6173fd34443fc73c64e1d50f 100644 (file)
@@ -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,