Project

General

Profile

Bug #62553 » objectstorage-offsetexists-check-object.patch

Fix + Unit tests - Mathias Brodala, 2014-10-30 11:36

View differences:

typo3/sysext/extbase/Classes/Persistence/ObjectStorage.php
* @return bool
*/
public function offsetExists($object) {
return isset($this->storage[spl_object_hash($object)]);
return is_object($object) && isset($this->storage[spl_object_hash($object)]);
}
/**
typo3/sysext/extbase/Tests/Unit/Persistence/ObjectStorageTest.php
/**
* @test
*/
public function offsetExistsWorksWithEmptyStorageAndIntegerKey() {
$objectStorage = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->assertEquals($objectStorage->offsetExists(0), FALSE);
}
/**
* @test
*/
public function offsetExistsWorksWithEmptyStorageAndStringKey() {
$objectStorage = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->assertEquals($objectStorage->offsetExists('0'), FALSE);
}
/**
* @test
*/
public function getInfoReturnsTheDataAssociatedWithTheCurrentIteratorEntry() {
$objectStorage = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$object1 = new \StdClass();
(2-2/2)