mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.3' into PHP-8.4
This commit is contained in:
@@ -754,13 +754,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);
|
||||
|
||||
22
ext/intl/tests/uconverter_transcode_references.phpt
Normal file
22
ext/intl/tests/uconverter_transcode_references.phpt
Normal 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"
|
||||
Reference in New Issue
Block a user