summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
authorJoel Kallman <jkallman@eclarian.com>2012-03-09 20:54:53 +0100
committerJoel Kallman <jkallman@eclarian.com>2012-03-09 20:54:53 +0100
commit10aa8e660c6f439958b79fce5d85ce7e8eecf028 (patch)
tree594ab55fc205449c266278a0b47dcd7374783a77 /system/database
parentc10144c1d2a53c4662d3de911fdd3989b389b163 (diff)
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 <jkallman@eclarian.com>
Diffstat (limited to 'system/database')
-rw-r--r--system/database/DB_driver.php2
1 files changed, 1 insertions, 1 deletions
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)."'";
}