From ede724a76d692d6daa658eb0e4bdc4ec69281b9c Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Mon, 23 Mar 2015 14:39:57 +0000 Subject: [PATCH] dblayer : don't allow the information which are not string git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2057 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- dblayer.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dblayer.php b/dblayer.php index d63cac3..0b50512 100644 --- a/dblayer.php +++ b/dblayer.php @@ -275,7 +275,15 @@ class dblayer extends PDO continue; } // Check for type inconsistencies if the value is provided - if ($datas[$key] !== "" && $params[0] === "integer") + if (! is_string ($datas[$key])) + { + $errors[$key] = array ("error", sprintf ( + dgettext("domframework", + "Errors in consistency : '%s' is not an string [is %s]"), + $key, gettype ($datas[$key]))); + continue; + } + elseif ($datas[$key] !== "" && $params[0] === "integer") { if (strspn ($datas[$key], "0123456789") !== strlen ($datas[$key])) { @@ -441,6 +449,7 @@ class dblayer extends PDO } } +$this->debug = 1; // Check if the foreign keys constrains are valid before doing the insertion foreach ($this->foreign as $foreign=>$data) {