noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 152/219: HttpInput: Exception if the type is


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 152/219: HttpInput: Exception if the type is not known,
Date: Mon, 18 Dec 2017 13:22:55 -0500 (EST)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 944a83e3bbc920b1c2ab1e03d7eda17431b2a55d
Author: Dany De Bontridder <address@hidden>
Date:   Wed Nov 15 20:35:38 2017 +0100

    HttpInput: Exception if the type is not known,
---
 include/lib/http_input.class.php | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/include/lib/http_input.class.php b/include/lib/http_input.class.php
index d486cd6..bdaf97a 100644
--- a/include/lib/http_input.class.php
+++ b/include/lib/http_input.class.php
@@ -48,27 +48,32 @@ class HttpInput
             if ($p_type=="string")
                 return;
             // Check if number
-            else if ($p_type=="number"&&isNumber($this->array[$p_name])==0 )
+            else if ($p_type=="number")
             {
+                if ( isNumber($this->array[$p_name])==0 )
+                {
+                    throw new Exception(_("Type invalide")."[ $p_name ] = 
{$this->array[$p_name]}"
+                    , EXC_PARAM_TYPE);
+                }
                 $this->array[$p_name]=h($this->array[$p_name]);
-                throw new Exception(_("Type invalide")."[ $p_name ] = 
{$this->array[$p_name]}"
-                , EXC_PARAM_TYPE);
             }
             // Check if date dd.mm.yyyy
             else if ($p_type=="date")
             {
                 if (isDate($this->array[$p_name]) <> $this->array[$p_name])
                 {
-                    $this->array[$p_name]=h($this->array[$p_name]);
                     throw new Exception(_("Type invalide")."[ $p_name ] = 
{$this->array[$p_name]}"
                     , EXC_PARAM_TYPE);
                 }
+                $this->array[$p_name]=h($this->array[$p_name]);
             }
-            else if ($p_type=="array"&&!is_array($this->array[$p_name]))
+            else if ($p_type=="array")
             {
-                $this->array[$p_name]=h($this->array[$p_name]);
-                throw new Exception(_("Type invalide")."[ $p_name ] = 
{$this->array[$p_name]}"
+                if (!is_array($this->array[$p_name]) ) {
+                    throw new Exception(_("Type invalide")."[ $p_name ] = 
{$this->array[$p_name]}"
                 , EXC_PARAM_TYPE);
+                }
+                $this->array[$p_name]=h($this->array[$p_name]);
             }else {
                 throw new Exception(_("Unknown type"));
             }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]