Bug #75784 [Opn]: The string must be interrupted by a carry, and in fact, it is replaced with cha

From: 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

« previous php.bugs (#213437) next »