Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update pdo_db::escape() to accept an array

  • Loading branch information...
commit 1a72bacd780d63c616622175dafffce332b90c2b 1 parent 1981d1f
@mrtorrent authored
Showing with 14 additions and 3 deletions.
  1. +14 −3 pdo/db.php
View
17 pdo/db.php
@@ -110,11 +110,22 @@ function createDBObject(){
* similarly, using mysql_escape_string() (which you would think would be logical) screws things up to.
* basically does not honour line terminators.
*
- * @param $string string the variable to be escaped
+ * @param string|array $data to escape
* @return string escaped variable
*/
- function escape($string) {
- return addslashes($string);
+ function escape($data) {
+ if (is_array($data)) {
+ foreach ($data as $k => $v) {
+ if (is_array($v))
+ $data[$k] = $this->escape($v);
+ else
+ $data[$k] = addslashes($v);
+ }
+ } else {
+ $data = addslashes($data);
+ }
+
+ return $data;
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.