return $isInputBufferEmpty;
}
+ /**
+ * Checks whether given package content is completed (start/end markers are found)
+ *
+ * @param $packageContent An array with two elements: 'decoded_data' and 'error_code'
+ * @return $isCompleted Whether the given package content is completed
+ */
+ private function isPackageContentCompleted (array $packageContent) {
+ // Check both
+ $isCompleted = ((substr($packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA], 0, 5) == '[[S]]') && (substr($packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA], -5, 5) == '[[E]]'));
+
+ // Return status
+ return $isCompleted;
+ }
+
/**
* Assembles the content from $packageContent. This method does only
* initialize the whole process by creating a call-back which will then
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: packageData[' . BaseRawDataHandler::PACKAGE_DECODED_DATA . ']=' . $packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA]);
// Check for some conditions
- if (!$this->ifInputBufferIsEmpty()) {
+ if ((!$this->ifInputBufferIsEmpty()) || (!$this->isPackageContentCompleted($packageContent))) {
// Last chunk is not valid, so wait for more
$this->pendingData .= $packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA];