From 82a76bec4f9e31799e17cba18d569e4024f53e22 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Wed, 24 Jul 2024 15:20:00 +0200 Subject: [PATCH 1/2] 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. --- ext/intl/uchar/tests/gh15087.phpt | 10 ++++++++++ ext/intl/uchar/uchar.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 ext/intl/uchar/tests/gh15087.phpt diff --git a/ext/intl/uchar/tests/gh15087.phpt b/ext/intl/uchar/tests/gh15087.phpt new file mode 100644 index 0000000000000..62009857ab1d6 --- /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 771805925827f..6c1c93c8408d1 100644 --- a/ext/intl/uchar/uchar.c +++ b/ext/intl/uchar/uchar.c @@ -392,7 +392,7 @@ 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_LONG(options) ZEND_PARSE_PARAMETERS_END(); From 0ba36cd119fc85a2d5d50932d82210631797f66a Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Wed, 24 Jul 2024 15:41:12 +0200 Subject: [PATCH 2/2] Add missing `Z_PARAM_OPTIONAL` --- ext/intl/uchar/uchar.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/intl/uchar/uchar.c b/ext/intl/uchar/uchar.c index 6c1c93c8408d1..7cb6a553af824 100644 --- a/ext/intl/uchar/uchar.c +++ b/ext/intl/uchar/uchar.c @@ -394,6 +394,7 @@ IC_METHOD(foldCase) { 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();