terminal42 / contao-changelanguage

ChangeLanguage is an extension for the Contao CMS which allows visitors to switch between different languages of your website.
44 stars 35 forks source link

Wrong return type using Symfony v5.4.39 #251

Closed bennyborn closed 5 months ago

bennyborn commented 5 months ago

After a quick update I received the following exception when trying to edit a news archive (child records)

TypeError:
Terminal42\ChangeLanguage\EventListener\DataContainer\MissingLanguageIconListener::getChildTranslation(): Return value must be of type ?int, string returned

  at vendor/terminal42/contao-changelanguage/src/EventListener/DataContainer/MissingLanguageIconListener.php:297
  at Terminal42\ChangeLanguage\EventListener\DataContainer\MissingLanguageIconListener->getChildTranslation(184, 'tl_news', 'tl_news_archive', 'master')
     (vendor/terminal42/contao-changelanguage/src/EventListener/DataContainer/MissingLanguageIconListener.php:144)
  at Terminal42\ChangeLanguage\EventListener\DataContainer\MissingLanguageIconListener->onNewsChildRecords([REDACTED])
     (vendor/terminal42/contao-changelanguage/src/EventListener/DataContainer/MissingLanguageIconListener.php:52)
  at Terminal42\ChangeLanguage\EventListener\DataContainer\MissingLanguageIconListener->Terminal42\ChangeLanguage\EventListener\DataContainer\{closure}([REDACTED])
     (vendor/contao/core-bundle/src/Resources/contao/drivers/DC_Table.php:4721)
  at Contao\DC_Table->parentView()
     (vendor/contao/core-bundle/src/Resources/contao/drivers/DC_Table.php:313)
  at Contao\DC_Table->showAll()
     (vendor/contao/core-bundle/src/Resources/contao/classes/Backend.php:667)
  at Contao\Backend->getBackendModule('news', null)
     (vendor/contao/core-bundle/src/Resources/contao/controllers/BackendMain.php:168)
  at Contao\BackendMain->run()
     (vendor/contao/core-bundle/src/Controller/BackendController.php:49)
  at Contao\CoreBundle\Controller\BackendController->mainAction()
     (vendor/symfony/http-kernel/HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:75)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:202)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (public/index.php:44)   

This seems to happen in all 3.7.x releases due to a change in symfony/framework-bundle with version v5.4.39. For the moment I added a conflict into my composer.json for this specific Symfony version.

fritzmg commented 5 months ago

Which version are you using? This should be fixed in 3.7.2.

bennyborn commented 5 months ago

Nevermind. Seems like I wasn't on 3.7.2 :\