Actions
Bug #67144
closedObjectStorage->detach does not decrease positionCounter
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2015-05-26
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.5
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:
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
Actions