From 8907c9944db8e644eeb144f42fd95e86a179bf2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 7 Nov 2013 20:51:30 +0100 Subject: [PATCH] Assigments in conditions is often considered bad practice So let's put a comment, just in case --- htdocs/comm/action/class/actioncomm.class.php | 2 ++ htdocs/comm/propal/class/propal.class.php | 2 ++ htdocs/ecm/class/ecmdirectory.class.php | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 0310f5e0cdd..33057e96eb8 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -611,6 +611,7 @@ class ActionComm extends CommonObject $resql=$this->db->query($sql); if ($resql) { + // This assignment in condition is not a bug. It allows walking the results. while ($obj=$this->db->fetch_object($resql)) { $this->nbtodo++; @@ -933,6 +934,7 @@ class ActionComm extends CommonObject if ($resql) { // Note: Output of sql request is encoded in $conf->file->character_set_client + // This assignment in condition is not a bug. It allows walking the results. while ($obj=$this->db->fetch_object($resql)) { $qualified=true; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index b03d67f1701..ada87415b11 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2368,6 +2368,7 @@ class Propal extends CommonObject if ($mode == 'opened') $delay_warning=$conf->propal->cloture->warning_delay; if ($mode == 'signed') $delay_warning=$conf->propal->facturation->warning_delay; + // This assignment in condition is not a bug. It allows walking the results. while ($obj=$this->db->fetch_object($resql)) { $this->nbtodo++; @@ -2506,6 +2507,7 @@ class Propal extends CommonObject $resql=$this->db->query($sql); if ($resql) { + // This assignment in condition is not a bug. It allows walking the results. while ($obj=$this->db->fetch_object($resql)) { $this->nb["proposals"]=$obj->nb; diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 35a03f487f9..b80cc84414e 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -490,7 +490,8 @@ class EcmDirectory // extends CommonObject $resql = $this->db->query($sql); if ($resql) { - while ($obj= $this->db->fetch_object($resql)) + // This assignment in condition is not a bug. It allows walking the results. + while ($obj=$this->db->fetch_object($resql)) { $this->motherof[$obj->id_son]=$obj->id_parent; } @@ -555,6 +556,7 @@ class EcmDirectory // extends CommonObject { $this->cats = array(); $i=0; + // This assignment in condition is not a bug. It allows walking the results. while ($obj = $this->db->fetch_object($resql)) { $this->cats[$obj->rowid]['id'] = $obj->rowid;