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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Fri Jan 31 14:01:29 2025 UTC