From: Roland Haeder Date: Sun, 16 Feb 2014 00:05:04 +0000 (+0100) Subject: Rewrote some debug lines. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=25384b7e496a3c62b3c7b0eb50f21932436b24a7;p=hub.git Rewrote some debug lines. Signed-off-by: Roland Haeder --- diff --git a/application/hub/main/handler/chunks/class_ChunkHandler.php b/application/hub/main/handler/chunks/class_ChunkHandler.php index 746bd855b..2486969c7 100644 --- a/application/hub/main/handler/chunks/class_ChunkHandler.php +++ b/application/hub/main/handler/chunks/class_ChunkHandler.php @@ -151,15 +151,22 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable * @return $isValid Whether the hash is "valid" */ private function isChunkHashValid (array $chunkSplits) { + // Noisy debug line: + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CHUNK-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: chunkSplits=' . print_r($chunkSplits, TRUE)); + + // Assert on some elements + assert(isset($chunkSplits[self::CHUNK_SPLITS_INDEX_RAW_DATA])); + assert(isset($chunkSplits[self::CHUNK_SPLITS_INDEX_HASH])); + // Now hash the raw data again $chunkHash = $this->getCryptoInstance()->hashString($chunkSplits[self::CHUNK_SPLITS_INDEX_RAW_DATA], $chunkSplits[self::CHUNK_SPLITS_INDEX_HASH], FALSE); - // Debug output - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CHUNK-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: chunkHash=' . $chunkHash . ',chunkSplits[chunk_hash]=' . $chunkSplits[self::CHUNK_SPLITS_INDEX_HASH] . ',chunkSplits[serial]=' . $chunkSplits[self::CHUNK_SPLITS_INDEX_SERIAL] . ',chunkSplits[raw_data]=' . $chunkSplits[self::CHUNK_SPLITS_INDEX_RAW_DATA]); - // Check it $isValid = ($chunkSplits[self::CHUNK_SPLITS_INDEX_HASH] === $chunkHash); + // Debug output + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CHUNK-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: chunkHash=' . $chunkHash . ',isValid=' . intval($isValid)); + // ... and return it return $isValid; }