note 113811 added to function.preg-quote
| From: | ewering at gmail dot com | Date: | Thu, 05 Dec 2013 18:16:59 +0000 |
| Subject: | note 113811 added to function.preg-quote | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-197759@lists.php.net to get a copy of this message | ||
WARNING WARNING WARNING - this function does not work as you expect!
If you expect it to simply make any string you want to replace "harmless" no matter what
characters it contains, it does NOT do this!
I had to learn this the hard way by losing two hours of work in my web-based IDE which contains
server-side PHP code for global Search & Replace in a project, and when a string I wanted to
replace contained '/', it errored, causing random lines of code all over my project to be
DELETED!
AGAIN: This function does NOT quote every character that has a special meaning in a Perl regex,
DESPITE THE DOCUMENTATION!
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/function.preg-quote.php
Edit -- https://master.php.net/note/edit/113811
Del: integrated -- https://master.php.net/note/delete/113811/integrated
Del: useless -- https://master.php.net/note/delete/113811/useless
Del: bad code -- https://master.php.net/note/delete/113811/bad+code
Del: spam -- https://master.php.net/note/delete/113811/spam
Del: non-english -- https://master.php.net/note/delete/113811/non-english
Del: in docs -- https://master.php.net/note/delete/113811/in+docs
Del: other reasons-- https://master.php.net/note/delete/113811
Reject -- https://master.php.net/note/reject/113811
Search -- https://master.php.net/manage/user-notes.php