Bug #17856 Updated: quotemeta() does not escape all correct meta characters
| From: | derick@php.net | Date: | Thu, 20 Jun 2002 08:04:36 +0000 |
| Subject: | Bug #17856 Updated: quotemeta() does not escape all correct meta characters | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-11521@lists.php.net to get a copy of this message | ||
ID: 17856
Updated by: derick@php.net
Reported By: robbat2@orbis-terrarum.net
-Status: Open
+Status: Won't fix
Bug Type: Regexps related
Operating System: Linux, Apache 2.0.36
PHP Version: 4.1.2
New Comment:
From the manual:
quotemeta -- Quote meta characters
Description
string quotemeta ( string str)
Returns a version of str with a backslash character (\) before every
character that is among these:
. \\ + * ? [ ^ ] ( $ )
Seems totally clear to me that this is not a bug. As it's not a bug,
your 'report' should have the feature/request status, but we already
have a function for this, preg_quote. It sounds stupid to make a new
function that does exactly the same.
You may argue that we can change the quotemeta() function, but for all
we know this might break scripts, so we're not going to do that.
And please don't change the status back to open again,
Thank you.
Derick
Previous Comments:
------------------------------------------------------------------------
[2002-06-20 03:54:15] robbat2@orbis-terrarum.net
I'm writing code for phpMyAdmin, and we try to avoid the PCRE because
some people don't have it enabled. And we still support people that are
that don't have it enabled.
Quotemeta() should escape all of the correct characters for non-Perl
regular expressions.
In the name of correctness, PHP should have this.
------------------------------------------------------------------------
[2002-06-20 02:22:49] derick@php.net
We already have preg_quote for this..
Derick
------------------------------------------------------------------------
[2002-06-19 22:05:36] robbat2@orbis-terrarum.net
quotemeta() only escapes:
. \\ + * ? [ ^ ] ( $ )
To properly escape traditional characters for regexps, it is also
nessecary to escape '-' and '|', as the are the range and OR operators
respectively.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=17856&edit=1