Skip to content

Commit 487f248

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
2 parents e220e84 + 33967ae commit 487f248

File tree

3 files changed

+11
-26
lines changed

3 files changed

+11
-26
lines changed

UPGRADING

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,6 @@ PHP 8.3 UPGRADE NOTES
196196
. Calling ldap_connect() with separate hostname and port is deprecated.
197197
RFC: https://wiki.php.net/rfc/deprecations_php_8_3#deprecate_calling_ldap_connect_with_2_parameters
198198

199-
- Gettext:
200-
. dcgettext/dcngettext throw now an exception if the category's argument if set to
201-
`LC_ALL`.
202-
203199
- MBString
204200
. Passing a negative $width to mb_strimwidth() is now deprecated.
205201

ext/gettext/gettext.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@ ZEND_GET_MODULE(php_gettext)
6262
RETURN_THROWS(); \
6363
}
6464

65-
#define PHP_DCGETTEXT_CATEGORY_CHECK(_arg_num, category) \
66-
if (category == LC_ALL) { \
67-
zend_argument_value_error(_arg_num, "cannot be LC_ALL"); \
68-
RETURN_THROWS(); \
69-
}
70-
7165
PHP_MINFO_FUNCTION(php_gettext)
7266
{
7367
php_info_print_table_start();
@@ -153,7 +147,9 @@ PHP_FUNCTION(dcgettext)
153147

154148
PHP_GETTEXT_DOMAIN_LENGTH_CHECK(1, ZSTR_LEN(domain))
155149
PHP_GETTEXT_LENGTH_CHECK(2, ZSTR_LEN(msgid))
156-
PHP_DCGETTEXT_CATEGORY_CHECK(3, category)
150+
if (category == LC_ALL) {
151+
RETURN_STR_COPY(msgid);
152+
}
157153

158154
msgstr = dcgettext(ZSTR_VAL(domain), ZSTR_VAL(msgid), category);
159155

@@ -268,7 +264,9 @@ PHP_FUNCTION(dcngettext)
268264
PHP_GETTEXT_DOMAIN_LENGTH_CHECK(1, domain_len)
269265
PHP_GETTEXT_LENGTH_CHECK(2, msgid1_len)
270266
PHP_GETTEXT_LENGTH_CHECK(3, msgid2_len)
271-
PHP_DCGETTEXT_CATEGORY_CHECK(5, category)
267+
if (category == LC_ALL) {
268+
RETURN_STRING(msgid1);
269+
}
272270

273271
msgstr = dcngettext(domain, msgid1, msgid2, count, category);
274272

ext/gettext/tests/dcgettext_lcall.phpt

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,9 @@ dcgettext with LC_ALL is undefined behavior.
44
gettext
55
--FILE--
66
<?php
7-
try {
8-
dcgettext('dngettextTest', 'item', LC_ALL);
9-
} catch (ValueError $e) {
10-
echo $e->getMessage() . PHP_EOL;
11-
}
12-
13-
try {
14-
dcngettext('dngettextTest', 'item', 'item2', 1, LC_ALL);
15-
} catch (ValueError $e) {
16-
echo $e->getMessage();
17-
}
7+
var_dump(dcgettext('dngettextTest', 'item', LC_ALL));
8+
var_dump(dcngettext('dngettextTest', 'item', 'item2', 1, LC_ALL));
189
?>
19-
--EXPECTF--
20-
dcgettext(): Argument #3 ($category) cannot be LC_ALL
21-
dcngettext(): Argument #5 ($category) cannot be LC_ALL
10+
--EXPECT--
11+
string(4) "item"
12+
string(4) "item"

0 commit comments

Comments
 (0)