From 51934027369289abb8eeb8f33f0dcd016b28e088 Mon Sep 17 00:00:00 2001 From: phpnut Date: Sun, 1 Jan 2006 05:04:23 +0000 Subject: [PATCH] Merged Revision: [1696] Adding fix to allow NULL values to be passed as a string or NULL setting the SQL to NULL or "NULL". git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1697 3807eeeb-6ff5-0310-8944-8be069107fe0 --- VERSION.txt | 2 +- cake/libs/model/model.php | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 23a88bbf8..231a98f0e 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -6,4 +6,4 @@ // +---------------------------------------------------------------------------------------------------+ // /////////////////////////////////////////////////////////////////////////////////////////////////////////// -0.10.4.1695_beta \ No newline at end of file +0.10.4.1697_beta \ No newline at end of file diff --git a/cake/libs/model/model.php b/cake/libs/model/model.php index e7e537f85..0a179ce7d 100644 --- a/cake/libs/model/model.php +++ b/cake/libs/model/model.php @@ -800,9 +800,15 @@ class Model extends Object continue; } $fields[] = $x; + if($y === NULL) + { + $values[] = 'NULL'; + } + else + { $values[] = (ini_get('magic_quotes_gpc') == 1) ? $this->db->prepare(stripslashes($y)) : $this->db->prepare($y); - + } if($x == $this->primaryKey && !is_numeric($y)) { $newID = $y;