From 82d0c2e742a3c94556d59f501aaf4ceccee38d9a Mon Sep 17 00:00:00 2001 From: phpnut Date: Sun, 4 Mar 2007 04:05:57 +0000 Subject: [PATCH] Adding fix from Ticket #2074 git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4569 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/model/datasources/dbo/dbo_mysql.php | 10 ++++++++-- cake/libs/model/datasources/dbo/dbo_mysqli.php | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/cake/libs/model/datasources/dbo/dbo_mysql.php b/cake/libs/model/datasources/dbo/dbo_mysql.php index 0e246a8d6..8d1b1c2e6 100644 --- a/cake/libs/model/datasources/dbo/dbo_mysql.php +++ b/cake/libs/model/datasources/dbo/dbo_mysql.php @@ -251,12 +251,18 @@ class DboMysql extends DboSource { case 'boolean': $data = $this->boolean((bool)$data); break; + case 'integer' : + case 'float' : + case null : + if(is_numeric($data)) { + break; + } default: - $data = mysql_real_escape_string($data, $this->connection); + $data = "'" . mysql_real_escape_string($data, $this->connection) . "'"; break; } - return "'" . $data . "'"; + return $data; } /** * Begin a transaction diff --git a/cake/libs/model/datasources/dbo/dbo_mysqli.php b/cake/libs/model/datasources/dbo/dbo_mysqli.php index 597627345..a1d09504a 100644 --- a/cake/libs/model/datasources/dbo/dbo_mysqli.php +++ b/cake/libs/model/datasources/dbo/dbo_mysqli.php @@ -225,12 +225,18 @@ class DboMysqli extends DboSource { case 'boolean': $data = $this->boolean((bool)$data); break; + case 'integer' : + case 'float' : + case null : + if(is_numeric($data)) { + break; + } default: - $data = mysqli_real_escape_string($this->connection, $data); + $data = "'" . mysqli_real_escape_string($this->connection, $data) . "'"; break; } - return "'" . $data . "'"; + return $data; } /** * Begin a transaction