Skip to content

Commit fa964e8

Browse files
committed
Locale::setDefault
1 parent bb58985 commit fa964e8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

ext/intl/locale/locale_methods.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ PHP_NAMED_FUNCTION(zif_locale_set_default)
315315
char *default_locale = NULL;
316316

317317
ZEND_PARSE_PARAMETERS_START(1, 1)
318-
Z_PARAM_STR(locale_name)
318+
Z_PARAM_PATH_STR(locale_name)
319319
ZEND_PARSE_PARAMETERS_END();
320320

321321
if (ZSTR_LEN(locale_name) == 0) {

ext/intl/tests/locale_set_default.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ function ut_main()
8686
$res_str .= "\n";
8787
}
8888

89+
try {
90+
ut_loc_set_default("a-\0DE");
91+
} catch (\ValueError $e) {
92+
echo $e->getMessage(), PHP_EOL;
93+
}
94+
8995
return $res_str;
9096

9197
}
@@ -95,6 +101,8 @@ ut_run();
95101

96102
?>
97103
--EXPECT--
104+
Locale::setDefault(): Argument #1 ($locale) must not contain any null bytes
105+
locale_set_default(): Argument #1 ($locale) must not contain any null bytes
98106
uk-ua_CALIFORNIA@currency=;currency=GRN: set locale 'uk-ua_CALIFORNIA@currency=;currency=GRN'
99107
root: set locale 'root'
100108
uk@currency=EURO: set locale 'uk@currency=EURO'

0 commit comments

Comments
 (0)