title: Why is ArrayIterator subclass's constructor never called?
body: <p>I'm baffled why a subclass to <code>ArrayIterator</code> is never getting its <code>__construct</code> method called. Consider this example:</p>
  
  <pre><code>&lt;?php
  
  class ConstructorException extends Exception {}
  
  class Foo extends ArrayObject {
      function __construct( $arr = array(), $flags = 0, $iterator = 'ArrayIterator' ) {
          $iterator = 'FooIterator';
          parent::__construct( $arr, $flags, $iterator );
      }
  }
  
  class FooIterator extends ArrayIterator {
      function __construct( $array = array(), $flags = 0 ) {
          throw new ConstructorException( 'HELLO WORLD' ); // I AM NEVER CALLED.
          parent::__construct( $array, $flags );
      }
  }
  
  try {
      $f = new Foo( array( 1, 2, 3 ) );
      $it = $f-&gt;getIterator();
      if ( get_class( $it ) !== 'FooIterator' ) {
          throw new Exception( 'Expected iterator to be FooIterator.' );
      }
      die( "FAIL\n" );
  } catch ( ConstructorException $e ) {
      die( "PASS\n" );
  } catch ( \Exception $e ) {
      die( sprintf( "ERROR: %s\n", $e-&gt;getMessage() ) );
  }
  </code></pre>
  
  <p>In both PHP 5.4 an 5.5, the result is <code>FAIL</code>. Why?</p>