Project

General

Profile

Actions

Bug #91304

closed

CropVariantCollection doesn't iterate over the crop variants correctly when creating the collection

Added by Georgi Mateev about 4 years ago. Updated 23 days ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Image Cropping
Target version:
-
Start date:
2020-05-05
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

In the create() method there is the following code:

reset($persistedCollectionConfig);
                foreach ($tcaConfig as $id => &$cropVariantConfig) {
                    if (!isset($persistedCollectionConfig[$id])) {
                        $id = key($persistedCollectionConfig);
                        next($persistedCollectionConfig);
                    }
                    if (isset($persistedCollectionConfig[$id]['cropArea'])) {
                        $cropVariantConfig['cropArea'] = $persistedCollectionConfig[$id]['cropArea'];
                    }
                    if (isset($persistedCollectionConfig[$id]['focusArea'], $cropVariantConfig['focusArea'])) {
                        $cropVariantConfig['focusArea'] = $persistedCollectionConfig[$id]['focusArea'];
                    }
                    if (isset($persistedCollectionConfig[$id]['selectedRatio'], $cropVariantConfig['allowedAspectRatios'][$persistedCollectionConfig[$id]['selectedRatio']])) {
                        $cropVariantConfig['selectedRatio'] = $persistedCollectionConfig[$id]['selectedRatio'];
                    }
                }

The next() call is useless and leads to the iteration fetching wrong cofiguration data should there be more than 2 cropVariants.


Files

Actions

Also available in: Atom PDF