note 113811 deleted from function.preg-quote by aharvey
| From: | aharvey@php.net | Date: | Thu, 05 Dec 2013 20:45:24 +0000 |
| Subject: | note 113811 deleted from function.preg-quote by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197762@lists.php.net to get a copy of this message | ||
Note Submitter: ewering at gmail dot com
----
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!