From bcd23d89939d74a15fda7ed68898670d741abbfd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ma=C3=AFeul=20Rouquette?= <maieul@maieul.net>
Date: Mon, 19 Dec 2022 22:19:15 +0100
Subject: [PATCH] =?UTF-8?q?fix(#134):=20le=20crit=C3=A8re=20`{tri=5Fselon?=
 =?UTF-8?q?=5Freponse}`=20provquait=20une=20erreur=20en=20PHP=208.1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Un critère cela genère du code PHP, donc il faut "doublement
guillemeter" les chaînes

fix #134
---
 CHANGELOG.md                   | 3 +++
 public/formidable_criteres.php | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index f3e36552..f56d1979 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,9 @@
 
 - #113 Amélioration de l'ergonomie de la configuration des traitements : chaque traitement se trouve désormais dans un onglet (vertical)
 
+### Fixed
+
+- #134 Correction bug `{tri_selon_reponse}` sous PHP 8+
 ## [5.2.3] - 2022-11-08
 
 ### Fixed
diff --git a/public/formidable_criteres.php b/public/formidable_criteres.php
index 2b011711..50689413 100644
--- a/public/formidable_criteres.php
+++ b/public/formidable_criteres.php
@@ -39,7 +39,7 @@ function critere_tri_selon_reponse_dist($idb, &$boucles, $crit) {
 		$not = $crit->not;
 		$_quoi = calculer_liste($crit->param[0], array(), $boucles, $boucles[$idb]->id_parent);
 		$k = count($boucle->join)+1;
-		$boucle->join[$k]= array($t,'id_formulaires_reponse');
+		$boucle->join[$k]= array("'$t'","'id_formulaires_reponse'");
 		$boucle->from["L$k"]= 'spip_formulaires_reponses_champs';
 		$op = array("'='", "'L$k.nom'", "sql_quote(".$_quoi.")");
 		$boucle->where[]= array("'?'","!in_array($_quoi,array('date','id_formulaires_reponse'))",$op,"''");
-- 
GitLab