title: PHP fwrite not writing some lines
body: <p>today I encountered a weird behavoir of my logging class.</p>
  
  <p>I use this code to write all logged lines which are stored in the lines array into my logfile.</p>
  
  <p>This does work really good. Except for some cases...</p>
  
  <pre><code>$fp = fopen($this-&gt;logFile, 'w');
          foreach ($this-&gt;lines as $line) {
              fwrite($fp, $line . PHP_EOL);
          }
          fclose($fp);
  </code></pre>
  
  <p>I write log messages from many different classes, which access my core to get the central logger instance. They proceed to call one of my short methods (d, v, i, w, c) (Debug, Verbose, Info, Warning, Critical).</p>
  
  <p>So their message will be prefixed, dated and saved into my lines array</p>
  
  <p>Short method 'i'</p>
  
  <pre><code>public function i($message) {
      if($this-&gt;logLevel &lt;= SimpleLog::Info)
          $this-&gt;writeToLog($message, "Info");
  }
  </code></pre>
  
  <p>writeToLog</p>
  
  <pre><code>    private function writeToLog($message, $prefix = "Debug") {
          array_push($this-&gt;lines, "[" . date('H:i:s', time()) . "] [" . $prefix . "] " . $message);
      }
  </code></pre>
  
  <p>The messages to arrive. They are even stored in the lines array when I write them. But on a misterous way, some messages, which are not from the core, are NOT written to the file. They are printed in php just fine when I echo them but not in the file.</p>
  
  <p>I am completely lost rightnow why this is happening.</p>
  
  <p>I am using different namespaces if thats important. But I still wouldn't see a reason why it is not in that file.</p>
  
  <p>What the log should look like: <a href="https://paste.myvps.ch/uxexojituk.coffeescript" rel="nofollow noreferrer">Echoed Log</a>
  What it looks like: <a href="https://paste.myvps.ch/xepoyeguri.coffeescript" rel="nofollow noreferrer">Wrote to file log</a></p>