Bug #75784 [Opn]: The string must be interrupted by a carry, and in fact, it is replaced with cha
| From: | vklimin at 510710 dot com | Date: | Tue, 09 Jan 2018 09:12:51 +0000 |
| Subject: | Bug #75784 [Opn]: The string must be interrupted by a carry, and in fact, it is replaced with cha | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-213437@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75784&edit=1
ID: 75784
User updated by: vklimin at 510710 dot com
Reported by: vklimin at 510710 dot com
Summary: The string must be interrupted by a carry, and in
fact, it is replaced with cha
Status: Open
Type: Bug
Package: Regexps related
Operating System: Windows 10
PHP Version: 7.1.13
Block user comment: N
Private report: N
New Comment:
Expected result:
----------------
string(31) "ÐÑо Ñе
Ð²Ð°Ñ ÑÑÑока"
string(31) "ÐÑо Ñе
Ð²Ð°Ñ ÑÑÑока"
string(31) "ÐÑо Ñе
Ð²Ð°Ñ ÑÑÑока"
Previous Comments:
------------------------------------------------------------------------
[2018-01-09 09:08:12] vklimin at 510710 dot com
Description:
------------
An incorrect behavior of the function was detected when working with text in the UTF-8 format.
Instead of changing characters, characters disappear.
The string must be interrupted by a carry, and in fact, it is replaced with characters from another
encoding.
Test script:
---------------
<?php
$a = "ÐÑо ÑеÑÑÐ¾Ð²Ð°Ñ ÑÑÑока";
var_dump( preg_replace( '/(Ñе)ÑÑо(ваÑ)/u', "\1\n\2", $a
) );
var_dump( preg_replace( '/(Ñе)ÑÑо(ваÑ)/u', "\1" .
"\n" . "\2", $a ) );
var_dump( preg_replace( '/(Ñе)ÑÑо(ваÑ)/u', '\1' .
"\n" . '\2', $a ) );
?>
Expected result:
----------------
string(23) "ÐÑо Ñе
Ð²Ð°Ñ ÑÑÑока"
string(23) "ÐÑо Ñе
Ð²Ð°Ñ ÑÑÑока"
string(31) "ÐÑо Ñе
Ð²Ð°Ñ ÑÑÑока"
Actual result:
--------------
string(23) "ÐÑо
ÑÑÑока"
string(23) "ÐÑо
ÑÑÑока"
string(31) "ÐÑо Ñе
Ð²Ð°Ñ ÑÑÑока"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75784&edit=1