php.net |  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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: codes at designsandcodes dot com
New email:
PHP Version: OS:

 

 [2019-02-02 03:33 UTC] codes at designsandcodes dot com
Description:
------------
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:
----------------
'\a\\short\\path'

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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-02-02 19:01 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2019-02-02 19:01 UTC] cmb@php.net
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: Sat Dec 14 17:01:25 2024 UTC