|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #77848 Documentation on the /e removal is misleading
Submitted: 2019-04-04 23:33 UTC Modified: 2019-04-17 14:22 UTC
From: ksours at internetbrands dot com Assigned: cmb (profile)
Status: Closed Package: PCRE related
PHP Version: 7.1.28 OS:
Private report: No CVE-ID: None
 [2019-04-04 23:33 UTC] ksours at internetbrands dot com
At it says
"As of PHP 7.0.0 E_WARNING is emitted in this case and "\e" modifier has no effect."

This implies that the results of the function should be the same whether or not the /e modifier is present.  But the actual result is that preg_replace returns null if the modifier is there regardless of the RE or the target string.

I have no particular problem with the behavior, but the documentation should reflect it.

Test script:
$x = "1 2 3 a b c 4";

$y = preg_replace("#\d#e", 'X', $x));
$z = preg_replace("#\d#", 'X', $x));

//documentation implies that $y == $z


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-04-17 14:21 UTC]
Automatic comment from SVN on behalf of cmb
Log: Fix #77848: Documentation on the /e removal is misleading
 [2019-04-17 14:22 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2019-04-17 14:22 UTC]
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 [2019-04-17 14:25 UTC]
Automatic comment on behalf of cmb
Log: Fix #77848: Documentation on the /e removal is misleading
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Jan 20 06:01:23 2020 UTC