Check if classes is set before iterating over it when invoking a hook

This commit is contained in:
Kienan Stewart 2018-07-28 14:22:25 -04:00
parent 2cbb36ec09
commit 8c6fd65534
1 changed files with 5 additions and 0 deletions

View File

@ -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)) {