#67144ObjectStorage->detach does not decrease positionCounter
Description
I encountered that if you are doing something like:
$storage = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$storage->attach(\DateTime("2015-05-21 11:38:00"));
$storage->attach(\DateTime("2015-05-22 11:38:00"));
$storage->attach(\DateTime("2015-05-26 11:38:00"));
$now = \DateTime("2015-05-25 11:38:00");
foreach($storage as $storedObject){
if($storedObject <= $now){
$storage->detach($storedObject);
}
}
the positionCounter in ObjectStorage is not touched.
This is cousing the loop to jump over the next object and leaves us with an unprocessed item in the ObjectStorage, that should have been processed by the condition inside the loop, too.
The result of the code above would be:
ObjectStorage ->
(
\DateTime("2015-05-22 11:38:00"),
\DateTime("2015-05-26 11:38:00")
)
but it should be:
ObjectStorage ->
(
\DateTime("2015-05-26 11:38:00")
)
Tested on TYPO3 6.2.13 with PHP 5.5.9
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.