title: Why is mongoCursor->key() causing php to crash?
body: <p>I'm trying to run the test suite for doctrine\mongo-odm on my local machine. Php crashes with no error messages (when I say crash, I mean crash, the php process terminates) on the is test: <code>Doctrine\ODM\MongoDB\Test\Functional\FilesTest::testFiles</code>.</p>
  
  <p>The test has the following content:</p>
  
  <pre><code>public function testFiles()
  {
      $image = new File();
      $image-&gt;setName('Test');
      $image-&gt;setFile(__DIR__ . '/file.txt');
  
      $profile = new Profile();
      $profile-&gt;setFirstName('Jon');
      $profile-&gt;setLastName('Wage');
      $profile-&gt;setImage($image);
  
      $this-&gt;dm-&gt;persist($profile);
      $this-&gt;dm-&gt;flush();
  
      $this-&gt;assertInstanceOf('Doctrine\MongoDB\GridFSFile', $image-&gt;getFile());
      $this-&gt;assertFalse($image-&gt;getFile()-&gt;isDirty());
      $this-&gt;assertEquals(__DIR__ . '/file.txt', $image-&gt;getFile()-&gt;getFilename());
      $this-&gt;assertTrue(file_exists($image-&gt;getFile()-&gt;getFilename()));
      $this-&gt;assertEquals('These are the bytes...', $image-&gt;getFile()-&gt;getBytes());
  
      $image-&gt;setName('testing');
      $this-&gt;dm-&gt;flush();
      $this-&gt;dm-&gt;clear();
  
  fails here ===&gt;&gt;$image = $this-&gt;dm-&gt;find('Documents\File', $image-&gt;getId());
      $this-&gt;assertNotNull($image);
      $this-&gt;assertEquals('testing', $image-&gt;getName());
      $this-&gt;assertEquals('These are the bytes...', $image-&gt;getFile()-&gt;getBytes());
  }
  </code></pre>
  
  <p>I have tracked the failure deeper to <code>mongoCursor-&gt;key()</code> in <code>Doctrine\MongoDB\Cursor::key()</code>.</p>
  
  <p>I have tested the Mongo Grid FS on my system with the MongoFiles command line tool, and it is working fine.</p>
  
  <p>Without error messages I have no idea where to look. Does anyone have suggestions?</p>