|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77558 mb_ereg_replace() does not properly handle stray backslashes
Submitted: 2019-02-02 03:33 UTC Modified: 2019-02-02 19:01 UTC
From: codes at designsandcodes dot com Assigned: cmb (profile)
Status: Duplicate Package: mbstring related
PHP Version: 7.3.1 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: codes at designsandcodes dot com
New email:
PHP Version: OS:


 [2019-02-02 03:33 UTC] codes at designsandcodes dot com
Pre PHP 7.3, a stray backslash would be passed through in the replacement string, if it wasn't part of a backreference.  Now, it gets passed through followed by a null character.

Test script:
var_export( mb_ereg_replace( '[\\\\/]', '\\', '/a/short/path' ) );

Expected result:

Actual result:
'\\' . "\0" . 'a\\' . "\0" . 'short\\' . "\0" . 'path'


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-02-02 19:01 UTC]
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2019-02-02 19:01 UTC]
This looks like a duplicate of bug #77514, which will be fixed with PHP 7.3.2.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 25 23:01:29 2024 UTC