]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/class_BaseHubSystem.php
Refactured EOP chunk, now it is formatted as any regular chunk. This makes the code...
[hub.git] / application / hub / main / class_BaseHubSystem.php
index 4de321119f6054d8f9ac7294566c5806af064b38..845daef6b8b50cc9d43c0af62a3287a1f01ca138 100644 (file)
@@ -286,11 +286,17 @@ class BaseHubSystem extends BaseFrameworkSystem {
                // Default is all fine
                $isValid = true;
 
+               // Split the (possible) EOP chunk
+               $chunkSplits = explode(PackageFragmenter::CHUNK_DATA_HASH_SEPARATOR, $chunks[count($chunks) - 1]);
+
+               // Make sure chunks with only 3 elements are parsed (for details see ChunkHandler)
+               assert(count($chunkSplits) == 3);
+
                // Validate final chunk
-               if (substr($chunks[count($chunks) - 1], 0, strlen(PackageFragmenter::END_OF_PACKAGE_IDENTIFIER)) != PackageFragmenter::END_OF_PACKAGE_IDENTIFIER) {
+               if (substr($chunkSplits[2], 0, strlen(PackageFragmenter::END_OF_PACKAGE_IDENTIFIER)) != PackageFragmenter::END_OF_PACKAGE_IDENTIFIER) {
                        // Not fine
                        $isValid = false;
-               } elseif (substr_count($chunks[count($chunks) - 1], PackageFragmenter::CHUNK_HASH_SEPARATOR) != 1) {
+               } elseif (substr_count($chunkSplits[2], PackageFragmenter::CHUNK_HASH_SEPARATOR) != 1) {
                        // CHUNK_HASH_SEPARATOR shall only be found once
                        $isValid = false;
                }