|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12042 $ can't be escaped when using ereg function
Submitted: 2001-07-11 05:46 UTC Modified: 2001-07-11 05:51 UTC
From: teocl at globalsources dot com Assigned:
Status: Not a bug Package: *Regular Expressions
PHP Version: 4.0.6 OS: LINUX
Private report: No CVE-ID: None
 [2001-07-11 05:46 UTC] teocl at globalsources dot com
Please see the codes below:

$arrfile = '<?include("$DOCUMENT_ROOT/TEMPLATES/TOP-BANNER.HTM");?>';

        print "good\n";
        print "bad\n";


The result will return "bad" because the eregi can't find the expression in the $arrfile. If I removed the $, it will return "good". I guess "$" can't be escaped inside the eregi function. Please help.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-11 05:51 UTC]
This is known and expected behavior.  Please review the regex docs more carefully - also search the php-general mailing list archives.

The quick fix is to place 3 backslashes in front of the $.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Dec 09 23:01:27 2023 UTC