title: Generator function not executed PHP
body: <p>In the following code, I don't get 'handled' on my output. I see the filehandle a resource, the file gets opened en the contructor of FqReader is called, I checked all that. But with execution of FqReader::getread() I don't see output and the returned array is empty. The first while loop also does not get exectuted when I put while(1) instead of the logic test as in the code now.</p>
  
  <pre><code>&lt;?php
  
  class FastqFile {
      function __construct($filename) {
          if (substr($filename, -3, 3) == '.gz') {
              $this-&gt;handle = gzopen($filename, 'r');
              return $this-&gt;handle;
          }
          else
              $this-&gt;handle = fopen($filename, 'r');
              return $this-&gt;handle;
      }
  }
  
  class FqReader {
      function __construct($file_handle) {
          $this-&gt;handle = $file_handle;
      }
      function getread() {
          while ($header = fgets($this-&gt;handle) !== false) {
              echo "handled";
              $bases = fgets($this-&gt;handle);
              $plus = fgets($this-&gt;handle);
              $scores = fgets($this-&gt;handle);
              yield array($header, $plus, $scores);
          }
      }
  }
  
  $filename = $argv[1];
  $file_handle = new FastqFile($filename);
  var_dump($file_handle);
  $reader = new FqReader($file_handle);
  var_dump($reader-&gt;getread());
  </code></pre>
  
  <p>It outputs:</p>
  
  <pre><code>object(FastqFile)#1 (1) {
    ["handle"]=&gt;
    resource(5) of type (stream)
  }
  object(Generator)#3 (0) {
  }
  </code></pre>