Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ PHP NEWS

- Standard:
. Optimized pack(). (nielsdos, divinity76)
. Fixed bug GH-19070 (setlocale($type, NULL) should not be deprecated).
(nielsdos)

- URI:
. Return the singleton UrlValidationErrorType instances from Uri\WhatWg\Url
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_vm_execute.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Zend/zend_vm_execute.skl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# pragma GCC optimize("no-gcse")
# pragma GCC optimize("no-ivopts")
#endif
#ifdef _WIN64
#if defined(_WIN64) && defined(_M_X64)
/* See save_xmm_x86_64_ms_masm.asm */
void {%EXECUTOR_NAME%}_ex_real(zend_execute_data *ex)
#else
Expand Down
2 changes: 1 addition & 1 deletion ext/soap/php_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -1144,11 +1144,11 @@ int make_http_soap_request(zval *this_ptr,

if ((loc = get_http_header_value(ZSTR_VAL(http_headers), "Location:")) != NULL) {
php_url *new_url = php_url_parse(loc);
efree(loc);

if (new_url != NULL) {
zend_string_release_ex(http_headers, 0);
zend_string_release_ex(http_body, 0);
efree(loc);
if (new_url->scheme == NULL && new_url->path != NULL) {
new_url->scheme = phpurl->scheme ? zend_string_copy(phpurl->scheme) : NULL;
new_url->host = phpurl->host ? zend_string_copy(phpurl->host) : NULL;
Expand Down
4 changes: 2 additions & 2 deletions ext/standard/basic_functions.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2555,8 +2555,8 @@ function nl2br(string $string, bool $use_xhtml = true): string {}
function strip_tags(string $string, array|string|null $allowed_tags = null): string {}

/**
* @param array|string $locales
* @param string $rest
* @param array|string|null $locales
* @param string|null $rest
*/
function setlocale(int $category, $locales, ...$rest): string|false {}

Expand Down
2 changes: 1 addition & 1 deletion ext/standard/basic_functions_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 14 additions & 10 deletions ext/standard/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -4937,17 +4937,18 @@ PHP_FUNCTION(setlocale)
zend_string **strings = do_alloca(sizeof(zend_string *) * num_args, use_heap);

for (uint32_t i = 0; i < num_args; i++) {
if (UNEXPECTED(Z_TYPE(args[i]) != IS_ARRAY && !zend_parse_arg_str(&args[i], &strings[i], false, i + 2))) {
if (UNEXPECTED(Z_TYPE(args[i]) != IS_ARRAY && !zend_parse_arg_str(&args[i], &strings[i], true, i + 2))) {
zend_wrong_parameter_type_error(i + 2, Z_EXPECTED_ARRAY_OR_STRING, &args[i]);
goto out;
}
}

for (uint32_t i = 0; i < num_args; i++) {
zend_string *result;
if (Z_TYPE(args[i]) == IS_ARRAY) {
zval *elem;
ZEND_HASH_FOREACH_VAL(Z_ARRVAL(args[i]), elem) {
zend_string *result = try_setlocale_zval(cat, elem);
result = try_setlocale_zval(cat, elem);
if (EG(exception)) {
goto out;
}
Expand All @@ -4956,15 +4957,18 @@ PHP_FUNCTION(setlocale)
goto out;
}
} ZEND_HASH_FOREACH_END();
continue;
} else if (Z_ISNULL(args[i])) {
result = try_setlocale_str(cat, ZSTR_EMPTY_ALLOC());
} else {
zend_string *result = try_setlocale_str(cat, strings[i]);
if (EG(exception)) {
goto out;
}
if (result) {
RETVAL_STR(result);
goto out;
}
result = try_setlocale_str(cat, strings[i]);
}
if (EG(exception)) {
goto out;
}
if (result) {
RETVAL_STR(result);
goto out;
}
}

Expand Down
3 changes: 1 addition & 2 deletions ext/standard/tests/strings/gh18823_weak.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ try {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
Deprecated: setlocale(): Passing null to parameter #2 ($locales) of type string is deprecated in %s on line %d
--EXPECT--
no
8 changes: 8 additions & 0 deletions ext/standard/tests/strings/gh19070.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--TEST--
GH-19070 (setlocale($type, NULL) should not be deprecated)
--FILE--
<?php
var_dump(setlocale(LC_ALL, null));
?>
--EXPECTF--
string(%d) "%s"