|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77514 mb_ereg_replace() with trailing backslash adds null byte
Submitted: 2019-01-24 12:53 UTC Modified: 2019-01-24 14:19 UTC
From: legale dot legale at gmail dot com Assigned: nikic (profile)
Status: Closed Package: mbstring related
PHP Version: 7.3.1 OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
30 - 15 = ?
Subscribe to this entry?

 [2019-01-24 12:53 UTC] legale dot legale at gmail dot com
Function returns incorrect result.

Test script:
echo unpack("H*", mb_ereg_replace("123","def\\",$a))[1];
echo PHP_EOL;

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-01-24 13:07 UTC]
-Status: Open +Status: Verified -Package: *Extensibility Functions +Package: mbstring related
 [2019-01-24 13:07 UTC]
Confirmed: <>.
 [2019-01-24 14:18 UTC]
-Status: Verified +Status: Assigned -Assigned To: +Assigned To: nikic
 [2019-01-24 14:19 UTC]
-Summary: mb_ereg_replace() bug +Summary: mb_ereg_replace() with trailing backslash adds null byte
 [2019-01-24 14:24 UTC]
Automatic comment on behalf of
Log: Fixed bug #77514
 [2019-01-24 14:24 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Feb 27 03:01:24 2020 UTC