Bug #75784 [Opn->Nab]: The string must be interrupted by a carry, and in fact, it is replaced with cha
| From: | requinix@php.net | Date: | Tue, 09 Jan 2018 10:13:45 +0000 |
| Subject: | Bug #75784 [Opn->Nab]: 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-213438@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
Updated by: requinix@php.net
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
+Status: Not a bug
Type: Bug
-Package: Regexps related
+Package: PCRE related
Operating System: Windows 10
PHP Version: 7.1.13
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
"\1" == chr(1)
http://php.net/manual/ru/language.types.string.php#language.types.string.syntax.double
Previous Comments:
------------------------------------------------------------------------
[2018-01-09 09:12:50] vklimin at 510710 dot com
Expected result:
----------------
string(31) "ÐÑо Ñе
Ð²Ð°Ñ ÑÑÑока"
string(31) "ÐÑо Ñе
Ð²Ð°Ñ ÑÑÑока"
string(31) "ÐÑо Ñе
Ð²Ð°Ñ ÑÑÑока"
------------------------------------------------------------------------
[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