Bug #79118 [NEW]: mb_ereg_replace function cannot replace strings

From: Date: Wed, 15 Jan 2020 02:00:31 +0000
Subject: Bug #79118 [NEW]: mb_ereg_replace function cannot replace strings
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224901@lists.php.net to get a copy of this message
From: minhlt82 at gmail dot com Operating system: Linux PHP version: 7.4.1 Package: Regexps related Bug Type: Bug Bug description:mb_ereg_replace function cannot replace strings Description: ------------ The mb_ereg_replace function cannot replace strings that contain some characters with the SJIS encoding. In these cases, the result is NULL. It works well with PHP versions < 7.1 but fails with PHP 7.1 and above. Test script: --------------- mb_regex_encoding('SJIS'); $string = "hello ここに文を入れる。"; $pattern = "hello"; $replacement = 'hi'; //expected result: hi ここに文を入れる。 //but it returns NULL var_dump(mb_ereg_replace($pattern, $replacement, $string)); //Similar error for binary strings, you can test more here. //http://sandbox.onlinephpfunctions.com/code/1a741afb48b299c6f335d9175be730a5ec3854d5 -- Edit bug report at https://bugs.php.net/bug.php?id=79118&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79118&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79118&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79118&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79118&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79118&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79118&r=support Expected behavior: https://bugs.php.net/fix.php?id=79118&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79118&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79118&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79118&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79118&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79118&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79118&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79118&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79118&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79118&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79118&r=mysqlcfg

« previous php.bugs (#224901) next »