]> git.mxchange.org Git - hub.git/commitdiff
Remove last CHUNK_SEPARATOR or else the final chunk will be empty ...
authorRoland Häder <roland@mxchange.org>
Tue, 7 Aug 2012 16:26:55 +0000 (16:26 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 7 Aug 2012 16:26:55 +0000 (16:26 +0000)
application/hub/main/package/assembler/class_PackageAssembler.php

index de0148813512b373bf51dda2e49588cdb44153b7..36e36dc927ad361e6dc7f14d6d1cc6a16f2a6cb4 100644 (file)
@@ -193,6 +193,12 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable
                // Debug message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: Last block of partial data received. A total of ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes has been received.');
 
+               // Make sure last CHUNK_SEPARATOR is not there
+               if (substr($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA], -1, 1) == PackageFragmenter::CHUNK_SEPARATOR) {
+                       // Remove it
+                       $packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA] = substr($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA], 0, -1);
+               } // END - if
+
                /*
                 * "explode" the string from 'raw_data' with chunk separator to
                 * get an array of chunks. These chunks must then be verified by