note 114411 added to function.mssql-query
| From: | andy at atcri dot com | Date: | Mon, 17 Feb 2014 20:17:21 +0000 |
| Subject: | note 114411 added to function.mssql-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198536@lists.php.net to get a copy of this message | ||
Escaping the apostrophe with a blind preg_replace or str_replace may cause exponential growth of
apostrophes -- especially if magic quotes are enabled or passed values may already be escaped.
While not foolproof, this does address the problem:
if (preg_match("/\'/", preg_replace("/\'\'/", "",
$str))) {
$str = preg_replace("/\'/", "''", $str);
}
----
Server IP: 64.71.164.2
Probable Submitter: 162.17.51.209
----
Manual Page -- http://php.net/manual/en/function.mssql-query.php
Edit -- https://master.php.net/note/edit/114411
Del: integrated -- https://master.php.net/note/delete/114411/integrated
Del: useless -- https://master.php.net/note/delete/114411/useless
Del: bad code -- https://master.php.net/note/delete/114411/bad+code
Del: spam -- https://master.php.net/note/delete/114411/spam
Del: non-english -- https://master.php.net/note/delete/114411/non-english
Del: in docs -- https://master.php.net/note/delete/114411/in+docs
Del: other reasons-- https://master.php.net/note/delete/114411
Reject -- https://master.php.net/note/reject/114411
Search -- https://master.php.net/manage/user-notes.php