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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu Mar 28 18:01:29 2024 UTC