From 10aa8e660c6f439958b79fce5d85ce7e8eecf028 Mon Sep 17 00:00:00 2001 From: Joel Kallman Date: Fri, 9 Mar 2012 14:54:53 -0500 Subject: Adding Support to Properly Escape Objects that have __toString() magic method so that the object can be passed directly as a parameter in a condition without having to manually convert to a string Signed-off-by: Joel Kallman --- system/database/DB_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 9d92f2f87..a72bf3101 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -727,7 +727,7 @@ class CI_DB_driver { */ function escape($str) { - if (is_string($str)) + if (is_string($str) OR method_exists($str, '__toString')) { $str = "'".$this->escape_str($str)."'"; } -- cgit v1.2.3-24-g4f1b