From 8c6fd6553499cccc5201dbba523b803508e84b30 Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Sat, 28 Jul 2018 14:22:25 -0400 Subject: [PATCH] Check if classes is set before iterating over it when invoking a hook --- bureau/class/m_hooks.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bureau/class/m_hooks.php b/bureau/class/m_hooks.php index 1093b077..0e10746a 100644 --- a/bureau/class/m_hooks.php +++ b/bureau/class/m_hooks.php @@ -53,6 +53,11 @@ class m_hooks { // existe on l'execute et on rajoute ce qu'elle a retourné dans // un tableau $val = array(); + if (!$classes) { + // Leaving early if classes isn't set prevents PHP warnings. + // Happens frequently when running PHPUnit tests. + return $val; + } foreach ($classes as $c) { global $$c; if (method_exists($$c, $hname)) {