- getFData() : Renforcement de la robustesse de la fonction.

This commit is contained in:
Benjamin Renard 2008-11-09 01:06:30 +00:00
parent 0e51b76a0b
commit 0b78fe461d

View file

@ -48,6 +48,12 @@ function getFData($format,$data,$meth=NULL) {
if(is_array($data)) { if(is_array($data)) {
if ($meth==NULL) { if ($meth==NULL) {
while (ereg($expr,$format[$i],$ch)) { 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[3]) {
if ($ch[5]) { if ($ch[5]) {
$s=$ch[3]; $s=$ch[3];
@ -57,7 +63,7 @@ function getFData($format,$data,$meth=NULL) {
$s=0; $s=0;
$l=$ch[3]; $l=$ch[3];
} }
$val=substr((string)$data[$ch[1]],$s,$l); $val=substr((string)$val,$s,$l);
} }
else { else {
$val=$data[$ch[1]]; $val=$data[$ch[1]];