From 36c6a41b1bd6b86aaaaf81d3bd571a3504210002 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 May 2021 01:14:44 +0200 Subject: [PATCH] Fix non traversable case --- htdocs/blockedlog/ajax/check_signature.php | 6 ++++-- htdocs/blockedlog/class/authority.class.php | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/blockedlog/ajax/check_signature.php b/htdocs/blockedlog/ajax/check_signature.php index cc91182293eb3..ba164e3e715b4 100644 --- a/htdocs/blockedlog/ajax/check_signature.php +++ b/htdocs/blockedlog/ajax/check_signature.php @@ -55,8 +55,10 @@ $auth->signature = $block_static->getSignature(); -foreach ($blocks as &$b) { - $auth->blockchain .= $b->signature; +if (is_array($bocks)) { + foreach ($blocks as &$b) { + $auth->blockchain .= $b->signature; + } } $hash = $auth->getBlockchainHash(); diff --git a/htdocs/blockedlog/class/authority.class.php b/htdocs/blockedlog/class/authority.class.php index 2071eb03c47ae..4ec3fc6d07ef6 100644 --- a/htdocs/blockedlog/class/authority.class.php +++ b/htdocs/blockedlog/class/authority.class.php @@ -71,8 +71,10 @@ public function getLocalBlockChain() $this->blockchain = ''; - foreach ($blocks as &$b) { - $this->blockchain .= $b->signature; + if (is_array($bocks)) { + foreach ($blocks as &$b) { + $this->blockchain .= $b->signature; + } } return $this->blockchain;