title: Generator invalidated when wrapped inside IteratorIterator
body: <p>In PHP 5.6 to 7.1 a Generator instance seems to be invalidated when being wrapped inside an <code>IteratorIterator</code> class:</p>
  
  <pre><code>&lt;?php
  function natural_numbers()
  {
      for ($i = 1; ; $i++) {
          yield $i;
      }
  }
  
  $generator = natural_numbers();
  var_dump($generator-&gt;valid());
  var_dump($generator-&gt;current());
  
  $wrap = new IteratorIterator(natural_numbers());
  var_dump($wrap-&gt;valid());
  var_dump($wrap-&gt;current());
  
  $wrap-&gt;next();
  var_dump($wrap-&gt;valid());
  var_dump($wrap-&gt;current());
  </code></pre>
  
  <p>Remarkably the above outputs for all PHP versions</p>
  
  <pre><code>bool(true)
  int(1)
  
  bool(false)
  NULL
  
  bool(true)
  int(2)
  </code></pre>
  
  <p>In HHVM on the other hand I get</p>
  
  <pre><code>bool(true)
  int(1)
  
  bool(true)
  NULL
  
  bool(true)
  int(2)
  </code></pre>
  
  <p>which is weird as well... The iterator is valid but its current value is <code>null</code>.</p>
  
  <p>Is this a bug in PHP or is this expected and documented behaviour? I'm confused.</p>