mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 17:48:25 +01:00
Add more robust php unit to detect not escaped sql. Fix not escaped sql
This commit is contained in:
@@ -75,7 +75,7 @@ class mod_project_simple extends ModeleNumRefProjects
|
||||
$posindice=8;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet";
|
||||
$sql.= " WHERE ref LIKE '".$this->prefix."____-%'";
|
||||
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@@ -111,7 +111,7 @@ class mod_project_simple extends ModeleNumRefProjects
|
||||
$posindice=8;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet";
|
||||
$sql.= " WHERE ref like '".$this->prefix."____-%'";
|
||||
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
|
||||
@@ -76,7 +76,7 @@ class mod_task_simple extends ModeleNumRefTask
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(task.ref FROM " . $posindice . ") AS SIGNED)) as max";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "projet_task AS task, ";
|
||||
$sql .= MAIN_DB_PREFIX . "projet AS project WHERE task.fk_projet=project.rowid";
|
||||
$sql .= " AND task.ref LIKE '" . $this->prefix . "____-%'";
|
||||
$sql .= " AND task.ref LIKE '" . $this->db->escape($this->prefix) . "____-%'";
|
||||
$sql .= " AND project.entity = " . $conf->entity;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@@ -112,7 +112,7 @@ class mod_task_simple extends ModeleNumRefTask
|
||||
$posindice=8;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task";
|
||||
$sql.= " WHERE ref like '".$this->prefix."____-%'";
|
||||
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
Reference in New Issue
Block a user