title: contents of file is not read complete
body: <p>I have a textfile with currently 9130 lines which I read and parse for a keyword. Today I detected that the file is not read complete and I wonder why? </p>
  
  <p>php version: PHP 5.5.9 on ubuntu ( I know it is an old version) </p>
  
  <h3>Read the textfile with file()</h3>
  
  <pre><code>private function findTodoOld(  ) {
      $lines = file( $this-&gt;localFilename, FILE_SKIP_EMPTY_LINES );
  
      $matchedLines = array(  );
      foreach( $lines as $line ) {
          $pattern = '@todo';
          if ( strpos( $line, $pattern ) !== false ) {
              array_push( $matchedLines, $line );
          }
      }
      return $matchedLines;
  }
  </code></pre>
  
  <h3>Read the textfile with fopen()</h3>
  
  <pre><code>private function findTodo(  ) {
      $matchedLines = array(  );
  
      $handle = fopen($this-&gt;localFilename, "r");
      if ($handle) {
          while (($line = fgets($handle)) !== false) {
              // process the line read.
              if ( strpos( $line, "@todo" ) !== false ) {
                  array_push( $matchedLines, $line );
                 }
          }
  
          fclose($handle);
      } 
      return $matchedLines;
  }
  </code></pre>
  
  <p>Both approaches get the same result: </p>
  
  <ul>
  <li>The content of line 9100 is not read complete (and the rest of the file as well) </li>
  <li>If I remove line 9100, then the new line 9100 will as well not read complete (and the rest of the file as well)</li>
  <li>the <code>$matchedLines</code> contains 1173 entries. </li>
  </ul>
  
  <p>Running the approach with <code>fopen</code> with the same textfile on PHP 7.1.16 (on an OSX) works fine. All lines are read, the <code>$matchesLines</code>contains 1187 entries. </p>
  
  <p>My assumption: It has something todo with the memory. At the ubuntu machine php has a memory_limit of 128 M, which looks for me enough to process a textfile. </p>
  
  <p><strong>Any Idea how I can process the complete content of the file?</strong> </p>
  
  <p>Interessting would be as well how I can analyse why the line 9100 is not read complete.</p>