Patch for #3298701 breaks installation in at least PHP 8.5 together with module imageapi_optimize_webp
Dear L3D maintainers, at Tojio we copy the patches from your defaults from time to time to a local patches file - to be able to include own, project specific patches. I was just about updating and merging patches when I found that the patch 3298701.diff broke the installation.
This did not occur in local development, but when deploying it to the server (eek!). The reason seems to be a different PHP version (8.2.29 in l3d, 8.2.5 on the server). At least with PHP 8.2.5 the patch leads to a Fatal Error in our setup because the module imageapi_optimize_webp
extends the ImageStyleDownloadController
from core - which is modified in this very patch.
It seems that PHP versions newer than the one in my local l3d require that the method signature is exactly the same also in terms of default arguments like the last = 'public'
.
The complete error message is:
PHP Fatal error: Declaration of Drupal\imageapi_optimize_webp\Controller\ImageStyleDownloadController::deliver(Symfony\Component\HttpFoundation\Request $request, $scheme, Drupal\image\ImageStyleInterface $image_style, string $required_derivative_scheme) must be compatible with Drupal\image\Controller\ImageStyleDownloadController::deliver(Symfony\Component\HttpFoundation\Request $request, $scheme, Drupal\image\ImageStyleInterface $image_style, string $required_derivative_scheme = 'public') in /usr/local/www/apache24/data/soh/hoffnungszeichen.de/dev/web/modules/contrib/imageapi_optimize_webp/src/Controller/ImageStyleDownloadController.php on line 36
Now that I found the reason, its totally OK for me to just leave this patch out. I just wanted to share the insight with you in case this problem emerges somewhere else, too.