From d9519334f9992730569737e37fa5539b32bb633f Mon Sep 17 00:00:00 2001
From: Cerdic <cedric@yterium.com>
Date: Thu, 8 Jun 2023 17:39:17 +0200
Subject: [PATCH] =?UTF-8?q?fix:=20eviter=20une=20fatale=20sur=20le=20retou?=
 =?UTF-8?q?r=20non=20booleen=20des=20fonctions=20autoriser()=20pour=20aide?=
 =?UTF-8?q?r=20=C3=A0=20nettoyer=20le=20code?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Refs: #5341
---
 ecrire/inc/autoriser.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ecrire/inc/autoriser.php b/ecrire/inc/autoriser.php
index 57604070f6..1fa6240ca5 100644
--- a/ecrire/inc/autoriser.php
+++ b/ecrire/inc/autoriser.php
@@ -228,6 +228,11 @@ function autoriser_dist(string $faire, ?string $type = '', $id = null, $qui = nu
 		'autoriser' . _LOG_DEBUG
 	);
 
+	if (!is_bool($a)) {
+	     trigger_error(sprintf("Function %s should returns a boolean instead of %s (casts as boolean). This will trigger fatal error in future versions.", $f, gettype($a)), \E_USER_DEPRECATED);
+	     $a = (bool) $a;
+	}
+
 	return $a;
 }
 
-- 
GitLab