Bug #12042: $ can't be escaped when using ereg function

From: Date: Wed, 11 Jul 2001 09:46:09 +0000
Subject: Bug #12042: $ can't be escaped when using ereg function
Groups: php.dev 
Request: Send a blank email to php-dev+get-59677@lists.php.net to get a copy of this message
From: teocl@globalsources.com Operating system: LINUX PHP version: 4.0.6 PHP Bug Type: *Regular Expressions Bug description: $ can't be escaped when using ereg function Please see the codes below: <? $arrfile = '<?include("$DOCUMENT_ROOT/TEMPLATES/TOP-BANNER.HTM");?>'; if(eregi("<\?include\(\"\$DOCUMENT_ROOT/TEMPLATES/TOP-BANNER\.HTM\"\);\?>",$arrfile)) print "good\n"; else 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. -- Edit bug report at: http://bugs.php.net/?id=12042&edit=1

« previous php.dev (#59677) next »