From 2b62b57db326bf04692873176e4b7508674e89bb Mon Sep 17 00:00:00 2001 From: Olivier Berten Date: Sun, 31 Jan 2021 23:15:05 +0100 Subject: [PATCH] Fix funny comparison features of php between numbers and strings. See https://www.php.net/manual/language.operators.comparison.php --- include/sources.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/sources.php b/include/sources.php index f17523d..9c0c1d5 100644 --- a/include/sources.php +++ b/include/sources.php @@ -4,7 +4,9 @@ $sources = array(); $sql1 = 'SELECT * FROM '.db('sources').' ORDER BY year,editor,title'; $req1 = $mysqli->query($sql1) or die('Erreur SQL !
'.$sql1.'
'.$mysqli->error); while ($s = $req1->fetch_assoc()) { - $sources[$s['id']] = array('year' => $s['year'], 'editor' => $s['editor'], 'title' => $s['title'], 'description' => $s['description'], 'caption' => $s['caption'], 'pages' => json_decode($s['pages'])); + $pages = json_decode($s['pages']); + if($pages) $pages = array_map('strval', $pages); + $sources[$s['id']] = array('year' => $s['year'], 'editor' => $s['editor'], 'title' => $s['title'], 'description' => $s['description'], 'caption' => $s['caption'], 'pages' => $pages); } ?>