From 860c50ff86bfd22847d05086bef93dfa5d2054f3 Mon Sep 17 00:00:00 2001
From: Matthieu Marcillaud <marcimat@rezo.net>
Date: Thu, 14 Nov 2013 19:40:07 +0000
Subject: [PATCH] =?UTF-8?q?Notices=20PHP=20en=20moins=20(lorsde=20l'utilis?=
 =?UTF-8?q?ation=20du=20plugin=20Menus=20avec=20le=20tr=C3=A8s=20compliqu?=
 =?UTF-8?q?=C3=A9=20affichage=20de=20rubriques)=20Des=20=C3=A9critures=20t?=
 =?UTF-8?q?elles=20que=20`{0,#GET{articles=5Fmax=5Faffiches}}`=20dans=20un?=
 =?UTF-8?q?=20crit=C3=A8re=20de=20boucle=20cr=C3=A9aient=20des=20notices?=
 =?UTF-8?q?=20PHP.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ecrire/public/criteres.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/ecrire/public/criteres.php b/ecrire/public/criteres.php
index f6f61f9f4e..2d236bc646 100644
--- a/ecrire/public/criteres.php
+++ b/ecrire/public/criteres.php
@@ -992,8 +992,12 @@ function calculer_parties(&$boucles, $id_boucle, $debut, $mode){
 function calculer_critere_parties_aux($idb, &$boucles, $param){
 	if ($param[0]->type!='texte'){
 		$a1 = calculer_liste(array($param[0]), array('id_mere' => $idb), $boucles, $boucles[$idb]->id_parent);
-		preg_match(',^ *(-([0-9]+))? *$,', $param[1]->texte, $m);
-		return array("intval($a1)", ($m[2] ? $m[2] : 0));
+		if (isset($param[1]->texte)) {
+			preg_match(',^ *(-([0-9]+))? *$,', $param[1]->texte, $m);
+			return array("intval($a1)", ((isset($m[2]) and $m[2]) ? $m[2] : 0));
+		} else {
+			return array("intval($a1)", 0);
+		}
 	} else {
 		preg_match(',^ *(([0-9]+)|n) *(- *([0-9]+)? *)?$,', $param[0]->texte, $m);
 		$a1 = $m[1];
-- 
GitLab