com php-src: Fix #70453: IntlChar::foldCase() incorrect arguments and missing constants: ext/intl/uchar/tests/bug70453.phpt ext/intl/uchar/uchar.c
| From: | Christoph Michael Becker | Date: | Mon, 07 Sep 2015 21:02:56 +0000 |
| Subject: | com php-src: Fix #70453: IntlChar::foldCase() incorrect arguments and missing constants: ext/intl/uchar/tests/bug70453.phpt ext/intl/uchar/uchar.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88949@lists.php.net to get a copy of this message | ||
Commit: 1372909429b2f54bdab80f9599c17ccf6e456f08
Author: Christoph M. Becker <cmb@php.net> Mon, 7 Sep 2015 23:02:56 +0200
Parents: f402056194180de488de1c990f089dce70aae6e6
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1372909429b2f54bdab80f9599c17ccf6e456f08
Log:
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.
Bugs:
https://bugs.php.net/70453
Changed paths:
A ext/intl/uchar/tests/bug70453.phpt
M ext/intl/uchar/uchar.c
Diff:
diff --git a/ext/intl/uchar/tests/bug70453.phpt b/ext/intl/uchar/tests/bug70453.phpt
new file mode 100644
index 0000000..4b3024e
--- /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 0dbe9c9..79eb8fd 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,