From 0b78fe461db4b47802a2bf7cea37145dc0d36fcb Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Sun, 9 Nov 2008 01:06:30 +0000 Subject: [PATCH] - getFData() : Renforcement de la robustesse de la fonction. --- trunk/includes/functions.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/trunk/includes/functions.php b/trunk/includes/functions.php index 2c6ec5e9..1e0ac07f 100644 --- a/trunk/includes/functions.php +++ b/trunk/includes/functions.php @@ -48,6 +48,12 @@ function getFData($format,$data,$meth=NULL) { if(is_array($data)) { if ($meth==NULL) { while (ereg($expr,$format[$i],$ch)) { + if (is_array($data[$ch[1]])) { + $val = $data[$ch[1]][0]; + } + else { + $val = $data[$ch[1]]; + } if($ch[3]) { if ($ch[5]) { $s=$ch[3]; @@ -57,7 +63,7 @@ function getFData($format,$data,$meth=NULL) { $s=0; $l=$ch[3]; } - $val=substr((string)$data[$ch[1]],$s,$l); + $val=substr((string)$val,$s,$l); } else { $val=$data[$ch[1]];