diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 39851e8c16b..24cf59892ee 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -572,7 +572,7 @@ function run_sql($sqlfile, $silent = 1, $entity = 0, $usesavepoint = 1, $handler * Delete a constant * * @param DoliDB $db Database handler - * @param string|int $name Name of constant or rowid of line + * @param string $name Name of constant or rowid of line * @param int $entity Multi company id, -1 for all entities * @return int Return integer <0 if KO, >0 if OK * @@ -659,7 +659,7 @@ function dolibarr_get_const($db, $name, $entity = 1) * * @param DoliDB $db Database handler * @param string $name Name of constant - * @param string $value Value of constant + * @param int|string $value Value of constant * @param string $type Type of constant. Deprecated, only strings are allowed for $value. Caller must json encode/decode to store other type of data. * @param int $visible Is constant visible in Setup->Other page (0 by default) * @param string $note Note on parameter @@ -685,6 +685,8 @@ function dolibarr_set_const($db, $name, $value, $type = 'chaine', $visible = 0, $hookmanager = new HookManager($db); } + $value = (string) $value; // We force type string (may be int) + $parameters = array( 'name' => $name, 'value' => $value, @@ -741,7 +743,6 @@ function dolibarr_set_const($db, $name, $value, $type = 'chaine', $visible = 0, $conf->global->$name = $value; return 1; } else { - $error = $db->lasterror(); $db->rollback(); return -1; }