From 5fbda7309930d03494b4ad41dbed657cb2aae8be Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Wed, 24 Jul 2024 16:45:20 +0200 Subject: [PATCH] Fix GH-15087 IntlChar::foldCase()'s $option is not optional Since that parameter is supposed to be optional (and has been prior to PHP 8.0.0), we fix the implementation instead of the stub. Closes GH-15091. --- NEWS | 3 +++ ext/intl/uchar/tests/gh15087.phpt | 10 ++++++++++ ext/intl/uchar/uchar.c | 3 ++- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 ext/intl/uchar/tests/gh15087.phpt diff --git a/NEWS b/NEWS index 592ad5daa63..59ae1e052b3 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,9 @@ PHP NEWS . Fixed bug GH-14286 (ffi enum type (when enum has no name) make memory leak). (nielsdos, dstogov) +- Intl: + . Fixed bug GH-15087 (IntlChar::foldCase()'s $option is not optional). (cmb) + - Opcache: . Fixed bug GH-13817 (Segmentation fault for enabled observers after pass 4). (Bob) diff --git a/ext/intl/uchar/tests/gh15087.phpt b/ext/intl/uchar/tests/gh15087.phpt new file mode 100644 index 00000000000..62009857ab1 --- /dev/null +++ b/ext/intl/uchar/tests/gh15087.phpt @@ -0,0 +1,10 @@ +--TEST-- +GH-15087 (IntlChar::foldCase()'s $option is not optional) +--EXTENSIONS-- +intl +--FILE-- + +--EXPECT-- +string(1) "i" diff --git a/ext/intl/uchar/uchar.c b/ext/intl/uchar/uchar.c index 77180592582..7cb6a553af8 100644 --- a/ext/intl/uchar/uchar.c +++ b/ext/intl/uchar/uchar.c @@ -392,8 +392,9 @@ IC_METHOD(foldCase) { zend_string *string_codepoint; zend_long int_codepoint; - ZEND_PARSE_PARAMETERS_START(2, 2) + ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR_OR_LONG(string_codepoint, int_codepoint) + Z_PARAM_OPTIONAL Z_PARAM_LONG(options) ZEND_PARSE_PARAMETERS_END();