From 05c75fcebf18ec3f077c114e0483c40d57152e80 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Fri, 4 Apr 2008 11:24:57 +0000 Subject: [PATCH] Fix wrong conversion from '0' to '' in oracle_diry_hack. MDL-14182 ; merged from 19_STABLE --- lib/dmllib.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/dmllib.php b/lib/dmllib.php index 9c24aa1a0c..49460d4c1b 100644 --- a/lib/dmllib.php +++ b/lib/dmllib.php @@ -2344,13 +2344,20 @@ function oracle_dirty_hack ($table, &$dataobject, $usecache = true) { } /// Now, we have one empty value, going to be inserted to one NOT NULL, VARCHAR2 or CLOB field /// Try to get the best value to be inserted + + /// The '0' string doesn't need any transformation, skip + if ($fieldvalue === '0') { + continue; + } + + /// Transformations start if (gettype($fieldvalue) == 'boolean') { $dataobject->$fieldname = '0'; /// Transform false to '0' that evaluates the same for PHP } else if (gettype($fieldvalue) == 'integer') { $dataobject->$fieldname = '0'; /// Transform 0 to '0' that evaluates the same for PHP } else if (gettype($fieldvalue) == 'NULL') { $dataobject->$fieldname = '0'; /// Transform NULL to '0' that evaluates the same for PHP - } else { + } else if ($fieldvalue === '') { $dataobject->$fieldname = ' '; /// Transform '' to ' ' that DONT'T EVALUATE THE SAME /// (we'll transform back again on get_records_XXX functions and others)!! } -- 2.39.5