]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/class_BaseFrameworkSystem.php
Only seek back to old position if the header has been flushed.
[core.git] / inc / classes / main / class_BaseFrameworkSystem.php
index 06f3a4d6d6debc47f5201b4ad1fa3c9df52f4207..033718d949958c02f9eb54fee8e5cfe9d24cb094 100644 (file)
@@ -3054,6 +3054,15 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                // Simple flush file header which will create it.
                $this->flushFileHeader();
 
+               // Seek to beginning of file
+               $this->getIteratorInstance()->rewind();
+
+               // And update seek position ...
+               $this->updateSeekPosition();
+
+               // ... to write it back into the file
+               $this->flushFileHeader();
+
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!!', __METHOD__, __LINE__));
        }
 
@@ -3088,10 +3097,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                if ($flushHeader === TRUE) {
                        // Flush header
                        $this->flushFileHeader();
+
+                       // Seek to old position
+                       $this->seekToOldPosition();
                } // END - if
 
-               // Seek to old position
-               $this->seekToOldPosition();
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
        }