terminal42 / contao-notification_center

The most popular notification configuration extension for the Contao Open Source CMS!
63 stars 38 forks source link

Attempted to call an undefined method named "getName" #323

Closed lukasbableck closed 5 months ago

lukasbableck commented 5 months ago

https://github.com/terminal42/contao-notification_center/blob/main/src/Gateway/MailerGateway.php#L270

Symfony\Component\ErrorHandler\Error\UndefinedMethodError: Attempted to call an undefined method named "getName" of class "Contao\CoreBundle\Filesystem\FilesystemItem".

at vendor/terminal42/notification_center/src/Gateway/MailerGateway.php:270 at Terminal42\NotificationCenterBundle\Gateway\MailerGateway->copyBackendAttachments(object(Parcel), object(LanguageConfig)) (vendor/terminal42/notification_center/src/Gateway/MailerGateway.php:66) at Terminal42\NotificationCenterBundle\Gateway\MailerGateway->doSealParcel(object(Parcel)) (vendor/terminal42/notification_center/src/Gateway/AbstractGateway.php:42) at Terminal42\NotificationCenterBundle\Gateway\AbstractGateway->sealParcel(object(Parcel)) (vendor/terminal42/notification_center/src/NotificationCenter.php:279) at Terminal42\NotificationCenterBundle\NotificationCenter->sendParcel(object(Parcel)) (vendor/terminal42/notification_center/src/NotificationCenter.php:317) at Terminal42\NotificationCenterBundle\NotificationCenter->sendNotificationWithStamps(2, object(StampCollection)) (vendor/cgoit/contao-leads-optin-bundle/src/Controller/Module/LeadsOptInModule.php:163) at Cgoit\LeadsOptinBundle\Controller\Module\LeadsOptInModule->getResponse(object(FragmentTemplate), object(ModuleModel), object(Request)) (vendor/contao/core-bundle/src/Controller/FrontendModule/AbstractFrontendModuleController.php:40) at Contao\CoreBundle\Controller\FrontendModule\AbstractFrontendModuleController->__invoke(object(Request), object(ModuleModel), 'main', null) (vendor/symfony/http-kernel/HttpKernel.php:163) at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 2) (vendor/symfony/http-kernel/HttpKernel.php:75) ...

This happens only on Contao 4 with NC 2.x. The class Contao\CoreBundle\Filesystem\FilesystemItem doesn't have a getName method in Contao 4, it only exists in Contao 5. https://github.com/contao/contao/blob/4.13/core-bundle/src/Filesystem/FilesystemItem.php

Toflar commented 5 months ago

@m-vo should we backport this to 4.13 as it's experimental anyway?

m-vo commented 5 months ago

@m-vo should we backport this to 4.13 as it's experimental anyway?

I would be fine with this. 👍

Toflar commented 5 months ago

See https://github.com/contao/contao/pull/7109.