* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public function searchNextGap (int $length) {
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: length=%s', $length));
+ // Not supported here
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: length=%d - CALLED!', $length));
throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
}
$gapPosition = $this->getIteratorInstance()->searchNextGap(strlen($rawData));
// Gap position cannot be smaller than header length + 1
- assert($gapPosition > $this->getIteratorInstance()->getHeaderSize());
+ if ($gapPosition <= $this->getIteratorInstance()->getHeaderSize()) {
+ // Improper gap position
+ throw new UnexpectedValueException(sprintf('gapPosition[%s]=%d is not larger than headerSize=%d',
+ gettype($gapPosition),
+ $gapPosition,
+ $this->getIteratorInstance()->getHeaderSize()
+ ));
+ }
// Then write the data at that gap
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: groupId=%s,hash=%s,gapPosition=%s', $groupId, $hash, $gapPosition));