Skip to content
Snippets Groups Projects
Commit 9a7da081 authored by Robert Kärner's avatar Robert Kärner Committed by Oliver Bartsch
Browse files

[BUGFIX] Fix undefined key warnings in MagicImageService

Two undefined array key warnings are fixed, which
occurred on PHP 8 when accessing the MagicImageService.

Resolves: #95942
Releases: master
Change-Id: Ifc7c64a7e14b600e88154c82ae575a1c23f9f87c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72138


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarphysikbuddha <r.kaerner@oranto.de>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: default avatarphysikbuddha <r.kaerner@oranto.de>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarOliver Bartsch <bo@cedev.de>
parent ccb7a8e4
Branches
Tags
......@@ -49,8 +49,8 @@ class MagicImageService
public function createMagicImage(File $imageFileObject, array $fileConfiguration)
{
// Process dimensions
$maxWidth = MathUtility::forceIntegerInRange($fileConfiguration['width'], 0, $this->magicImageMaximumWidth);
$maxHeight = MathUtility::forceIntegerInRange($fileConfiguration['height'], 0, $this->magicImageMaximumHeight);
$maxWidth = MathUtility::forceIntegerInRange($fileConfiguration['width'] ?? 0, 0, $this->magicImageMaximumWidth);
$maxHeight = MathUtility::forceIntegerInRange($fileConfiguration['height'] ?? 0, 0, $this->magicImageMaximumHeight);
if (!$maxWidth) {
$maxWidth = $this->magicImageMaximumWidth;
}
......@@ -75,13 +75,16 @@ class MagicImageService
*/
public function setMagicImageMaximumDimensions(array $rteConfiguration)
{
$imageButtonConfiguration = [];
// Get maximum dimensions from the configuration of the RTE image button
$imageButtonConfiguration = (is_array($rteConfiguration['buttons.']) && is_array($rteConfiguration['buttons.']['image.'])) ? $rteConfiguration['buttons.']['image.'] : [];
if (is_array($imageButtonConfiguration['options.']) && is_array($imageButtonConfiguration['options.']['magic.'])) {
if ((int)$imageButtonConfiguration['options.']['magic.']['maxWidth'] > 0) {
if (is_array($rteConfiguration['buttons.']['image.'] ?? null)) {
$imageButtonConfiguration = $rteConfiguration['buttons.']['image.'];
}
if (is_array($imageButtonConfiguration['options.']['magic.'] ?? null)) {
if ((int)($imageButtonConfiguration['options.']['magic.']['maxWidth'] ?? 0) > 0) {
$this->magicImageMaximumWidth = (int)$imageButtonConfiguration['options.']['magic.']['maxWidth'];
}
if ((int)$imageButtonConfiguration['options.']['magic.']['maxHeight'] > 0) {
if ((int)($imageButtonConfiguration['options.']['magic.']['maxHeight'] ?? 0) > 0) {
$this->magicImageMaximumHeight = (int)$imageButtonConfiguration['options.']['magic.']['maxHeight'];
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment