1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.4'

This commit is contained in:
David Carlier
2025-03-15 11:38:05 +00:00
2 changed files with 24 additions and 2 deletions

View File

@@ -738,13 +738,13 @@ PHP_METHOD(UConverter, transcode) {
zval *tmpzval;
if (U_SUCCESS(error) &&
(tmpzval = zend_hash_str_find(Z_ARRVAL_P(options), "from_subst", sizeof("from_subst") - 1)) != NULL &&
(tmpzval = zend_hash_str_find_deref(Z_ARRVAL_P(options), "from_subst", sizeof("from_subst") - 1)) != NULL &&
Z_TYPE_P(tmpzval) == IS_STRING) {
error = U_ZERO_ERROR;
ucnv_setSubstChars(src_cnv, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval) & 0x7F, &error);
}
if (U_SUCCESS(error) &&
(tmpzval = zend_hash_str_find(Z_ARRVAL_P(options), "to_subst", sizeof("to_subst") - 1)) != NULL &&
(tmpzval = zend_hash_str_find_deref(Z_ARRVAL_P(options), "to_subst", sizeof("to_subst") - 1)) != NULL &&
Z_TYPE_P(tmpzval) == IS_STRING) {
error = U_ZERO_ERROR;
ucnv_setSubstChars(dest_cnv, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval) & 0x7F, &error);

View File

@@ -0,0 +1,22 @@
--TEST--
UConverter::transcode issue with substitutes values as references
--EXTENSIONS--
intl
--FILE--
<?php
$subst = '??';
$opts = array('from_subst' => '?', 'to_subst' => &$subst);
var_dump(UConverter::transcode("This is an ascii string", 'ascii', 'utf-8', $opts));
$opts = array('from_subst' => &$subst, 'to_subst' => '?');
var_dump(UConverter::transcode("This is an ascii string", 'ascii', 'utf-8', $opts));
// should yield the same results
$opts = array('from_subst' => '?', 'to_subst' => '??');
var_dump(UConverter::transcode("This is an ascii string", 'ascii', 'utf-8', $opts));
$opts = array('from_subst' => '??', 'to_subst' => '?');
var_dump(UConverter::transcode("This is an ascii string", 'ascii', 'utf-8', $opts));
?>
--EXPECT--
bool(false)
string(23) "This is an ascii string"
bool(false)
string(23) "This is an ascii string"