Closed thasmo closed 2 years ago
in branch master $_EXTKEY should be filled with the parameter for (static function (string $_EXTKEY) {
which you find at the end of the file: })('image_autoresize');
.
It might be though that you use PHP 8 where I don't know about changes or behavior yet.
Ow! I realized that the ext_localconf.php
file, in my case, was missing the static function wrapper - and so I figured that composer was installing quite an old version of the extension, in fact version 1.6.0
.
For now I'm using composer require --ignore-platform-reqs causal/image_autoresize:^2.1.1
to install the latest version.
With TYPO3 11 the static wrapper is not advised anymore, but it's neither disturbing.
At least without that wrapper the variable had to be assigned differently.
Furthermore the variable name should be in general different too as the name $_EXTKEY
had some magic inside TYPO3 and could be mistaken, also by code-sniffers, i.e. in the installtool.
With TYPO3 11 the static wrapper is not advised anymore, but it's neither disturbing.
You SHOULD use a directly called closure function to encapsulate all locally defined variables and thus keep them out of the surrounding scope. This avoids unexpected side-effects with files of other extensions.
I think that change note is about using namespace
within those files; this is not referring to using static functions to define scope.
You influence the caching behavior by wrapping. So without wrap you can avoid clearing the whole cache which can take quite some time on big sites to build up again.
"must not" is quite categorically
The warning and "must not" is really about namespacing, not closure as I do, but the remark regarding code sniffing while using a (local) $_EXTKEY
is a good point. Will think about it in the future.
When using the extension with TYPO3 v11 this exception comes up:
TYPO3 documentation states:
It seems that
$_EXTKEY
should not be used withinext_localconf.php
anymore, because TYPO3 does not set it anymore. This sounds like it is the reason for the exception.Do I miss something here or why would this exception be thrown? Thanks a lot!