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
This commit is contained in:
11
dblayer.php
11
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user