Misc errors cleanup (#14257)

* Misc errors cleanup

* Rename the variable in the loop to match

Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
Jellyfrog
2022-08-30 16:00:12 +02:00
committed by GitHub
parent 673ad552a1
commit 797d73ad16
2 changed files with 5 additions and 5 deletions

View File

@@ -109,7 +109,7 @@ class Plugins
foreach ((array) $hooks as $hookName) {
if ($hookName[0] != '_') {
self::$plugins[$hookName][] = $class;
self::$plugins[$hookName][] = $plugin;
}
}
}
@@ -183,12 +183,12 @@ class Plugins
ob_start();
if (! empty(self::$plugins[$hook])) {
foreach (self::$plugins[$hook] as $name) {
foreach (self::$plugins[$hook] as $plugin) {
try {
if (! is_array($params)) {
@call_user_func([$name, $hook]);
@call_user_func([$plugin, $hook]);
} else {
@call_user_func_array([$name, $hook], $params);
@call_user_func_array([$plugin, $hook], $params);
}
} catch (\Exception $e) {
Log::error($e);

View File

@@ -1289,7 +1289,7 @@ function cache_peeringdb()
$ix_json = $get_ix->body();
$ix_data = json_decode($ix_json);
$peers = $ix_data->{'data'};
foreach ($peers as $index => $peer) {
foreach ($peers ?? [] as $index => $peer) {
$peer_name = get_astext($peer->{'asn'});
$tmp_peer = dbFetchRow('SELECT * FROM `pdb_ix_peers` WHERE `peer_id` = ? AND `ix_id` = ?', [$peer->{'id'}, $ixid]);
if ($tmp_peer) {