From 8ed932864f296dfe29ba9ffc0b082a21ce5ab820 Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Sat, 2 Jul 2005 23:31:43 +0000 Subject: [PATCH] Better escaping from class, fixes #1394 git-svn-id: https://develop.svn.wordpress.org/trunk@2684 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/wp-db.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 8211b0844c..81c35ee5df 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -77,7 +77,10 @@ class wpdb { // Format a string correctly for safe insert under all PHP conditions function escape($str) { - return addslashes($str); + if( !$this->dbh || version_compare( phpversion(), '4.3.0' ) == '-1' ) + return mysql_escape_string( $string ); + else + return mysql_real_escape_string( $string, $this->dbh ); } // ==================================================================