From 70ff13bed7bc5056ae5b58d200280eff0b7f9f53 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Mon, 4 Oct 2010 08:47:58 +0000 Subject: [PATCH] MDLSITE-1007 ugly workaround for preventing of sloppy string to int casting in mysql --- lib/dml/mysqli_native_moodle_database.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dml/mysqli_native_moodle_database.php b/lib/dml/mysqli_native_moodle_database.php index 34bd9b8228a..8cdfe8620bc 100644 --- a/lib/dml/mysqli_native_moodle_database.php +++ b/lib/dml/mysqli_native_moodle_database.php @@ -610,8 +610,8 @@ class mysqli_native_moodle_database extends moodle_database { $return .= (int)$param; } else if (is_null($param)) { $return .= 'NULL'; - } else if (is_number($param)) { // we can not use is_numeric() because it eats leading zeros from strings like 0045646 - $return .= $param; + } else if (is_number($param)) { + $return .= "'".$param."'"; // we have to always use strings because mysql is using weird automatic int casting } else if (is_float($param)) { $return .= $param; } else {