php.net |  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
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: legale dot legale at gmail dot com
New email:
PHP Version: OS:

 

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

Test script:
---------------
<?php
$a="abc123";
echo unpack("H*", mb_ereg_replace("123","def\\",$a))[1];
echo PHP_EOL;



Expected result:
----------------
61626364655c

Actual result:
--------------
61626364655c00

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-01-24 13:07 UTC] cmb@php.net
-Status: Open +Status: Verified -Package: *Extensibility Functions +Package: mbstring related
 [2019-01-24 13:07 UTC] cmb@php.net
Confirmed: <https://3v4l.org/PHfJA>.
 [2019-01-24 14:18 UTC] nikic@php.net
-Status: Verified +Status: Assigned -Assigned To: +Assigned To: nikic
 [2019-01-24 14:19 UTC] nikic@php.net
-Summary: mb_ereg_replace() bug +Summary: mb_ereg_replace() with trailing backslash adds null byte
 [2019-01-24 14:24 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3c98c2d0cbf476432a4fa6264afc5e43c58fb38f
Log: Fixed bug #77514
 [2019-01-24 14:24 UTC] nikic@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 11:01:27 2019 UTC