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: Doctrine\ODM\MongoDB\Test\Functional\FilesTest::testFiles.
The test has the following content:
public function testFiles()
{
$image = new File();
$image->setName('Test');
$image->setFile(__DIR__ . '/file.txt');
$profile = new Profile();
$profile->setFirstName('Jon');
$profile->setLastName('Wage');
$profile->setImage($image);
$this->dm->persist($profile);
$this->dm->flush();
$this->assertInstanceOf('Doctrine\MongoDB\GridFSFile', $image->getFile());
$this->assertFalse($image->getFile()->isDirty());
$this->assertEquals(__DIR__ . '/file.txt', $image->getFile()->getFilename());
$this->assertTrue(file_exists($image->getFile()->getFilename()));
$this->assertEquals('These are the bytes...', $image->getFile()->getBytes());
$image->setName('testing');
$this->dm->flush();
$this->dm->clear();
fails here ===>>$image = $this->dm->find('Documents\File', $image->getId());
$this->assertNotNull($image);
$this->assertEquals('testing', $image->getName());
$this->assertEquals('These are the bytes...', $image->getFile()->getBytes());
}
I have tracked the failure deeper to mongoCursor->key() in Doctrine\MongoDB\Cursor::key().
I have tested the Mongo Grid FS on my system with the MongoFiles command line tool, and it is working fine.
Without error messages I have no idea where to look. Does anyone have suggestions?
There have been several related bugfixes made in 1.2.11-dev.
I can reproduce the crash using pecl/mongo v1.2.10, but not with the current v1.2.11-dev.