Closed bh-teufels closed 2 months ago
Encountered the same problem. Possible patch:
With
$severity = is_int($severity) ? $severity : $severity->value;
Not sure if is_int
is required.
Is the maintainer interested in a PR?
Is the maintainer interested in a PR?
of course :)
But the question would be to determine if $severity
may actually get passed as integer value or not.
Thanks for your reply @xperseguers :-)
I think the callback is only called in the following file. There, for Typo3 >= 12, the enum is used. https://github.com/xperseguers/t3ext-image_autoresize/blob/0d59a886a16addc75cc74634957f909e2caa0498/Classes/Service/ImageResizer.php#L249
It's probably safe to assume $severity
is of type ContextualFeedbackSeverity
in this case.
On the other hand, the variable is effectively of type mixed
and safeguards like assert
or is_int
probably won't hurt performance in a way that matters.
In the end it's about preference. Which way do you prefer? I'm happy to send a pr for the option you like.
Since the code is really for TYPO3 v12 and the ext is supposed to be the only one invoking that method, or at least we should expect people using it to stick to proper typing, I prefer assuming it's the enum only so that we stop having "mixed" type asap.
BUG: Execution of task "4" failed with the following message: PHP Warning: Object of class TYPO3\CMS\Core\Type\ContextualFeedbackSeverity could not be converted to int in [...]/vendor/causal/image_autoresize/Classes/Command/BatchResize.php line 231
affected code:
Debug: $severity =
caused by: Cast array to int not possible
environment: TYPO3 12.4.14 PHP 8.2.2 image_autoresize 2.4.1