Check if classes is set before iterating over it when invoking a hook
This commit is contained in:
parent
2cbb36ec09
commit
8c6fd65534
|
@ -53,6 +53,11 @@ class m_hooks {
|
||||||
// existe on l'execute et on rajoute ce qu'elle a retourné dans
|
// existe on l'execute et on rajoute ce qu'elle a retourné dans
|
||||||
// un tableau
|
// un tableau
|
||||||
$val = array();
|
$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) {
|
foreach ($classes as $c) {
|
||||||
global $$c;
|
global $$c;
|
||||||
if (method_exists($$c, $hname)) {
|
if (method_exists($$c, $hname)) {
|
||||||
|
|
Loading…
Reference in New Issue