Closed mscruse closed 2 months ago
Following the release of 5.1.0, a bug has been introduced.
The listener, AddFromSubmission, is expecting to call subscribe(), however, if a Form does not have MailChimp enabled, the Subscriber::fromSubmission($event->submission) will return null.
subscribe()
Subscriber::fromSubmission($event->submission)
This results in this error (paths edited):
{ "message": "Call to a member function subscribe() on null", "exception": "Error", "file": "/vendor/statamic-rad-pack/mailchimp/src/Listeners/AddFromSubmission.php", "line": 12, "trace": [ { "file": "/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php", "line": 478, "function": "handle", "class": "StatamicRadPack\\Mailchimp\\Listeners\\AddFromSubmission", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php", "line": 286, "function": "Illuminate\\Events\\{closure}", "class": "Illuminate\\Events\\Dispatcher", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php", "line": 266, "function": "invokeListeners", "class": "Illuminate\\Events\\Dispatcher", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php", "line": 433, "function": "dispatch", "class": "Illuminate\\Events\\Dispatcher", "type": "->" }, { "file": "/vendor/statamic/cms/src/Events/Event.php", "line": 21, "function": "event" }, { "file": "/vendor/statamic/cms/src/Forms/Submission.php", "line": 181, "function": "dispatch", "class": "Statamic\\Events\\Event", "type": "::" }, { "file": "/vendor/statamic/cms/src/Http/Controllers/FormController.php", "line": 78, "function": "save", "class": "Statamic\\Forms\\Submission", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Routing/Controller.php", "line": 54, "function": "submit", "class": "Statamic\\Http\\Controllers\\FormController", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php", "line": 43, "function": "callAction", "class": "Illuminate\\Routing\\Controller", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Routing/Route.php", "line": 259, "function": "dispatch", "class": "Illuminate\\Routing\\ControllerDispatcher", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Routing/Route.php", "line": 205, "function": "runController", "class": "Illuminate\\Routing\\Route", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 806, "function": "run", "class": "Illuminate\\Routing\\Route", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 144, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php", "line": 50, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Illuminate\\Routing\\Middleware\\SubstituteBindings", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php", "line": 78, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php", "line": 49, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Illuminate\\View\\Middleware\\ShareErrorsFromSession", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php", "line": 121, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php", "line": 64, "function": "handleStatefulRequest", "class": "Illuminate\\Session\\Middleware\\StartSession", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Illuminate\\Session\\Middleware\\StartSession", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php", "line": 37, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php", "line": 67, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Illuminate\\Cookie\\Middleware\\EncryptCookies", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/HandlePrecognitiveRequests.php", "line": 41, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\HandlePrecognitiveRequests", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 119, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 805, "function": "then", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 784, "function": "runRouteWithinStack", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 748, "function": "runRoute", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 737, "function": "dispatchToRoute", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", "line": 200, "function": "dispatch", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 144, "function": "Illuminate\\Foundation\\Http\\{closure}", "class": "Illuminate\\Foundation\\Http\\Kernel", "type": "->" }, { "file": "/vendor/statamic/cms/src/Http/Middleware/StopImpersonating.php", "line": 12, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Statamic\\Http\\Middleware\\StopImpersonating", "type": "->" }, { "file": "/vendor/statamic/cms/src/Http/Middleware/DisableFloc.php", "line": 17, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Statamic\\Http\\Middleware\\DisableFloc", "type": "->" }, { "file": "/vendor/statamic/cms/src/Http/Middleware/CheckMultisite.php", "line": 15, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Statamic\\Http\\Middleware\\CheckMultisite", "type": "->" }, { "file": "/vendor/statamic/cms/src/Http/Middleware/CheckComposerJsonScripts.php", "line": 14, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Statamic\\Http\\Middleware\\CheckComposerJsonScripts", "type": "->" }, { "file": "/vendor/statamic/cms/src/Http/Middleware/PoweredByHeader.php", "line": 18, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Statamic\\Http\\Middleware\\PoweredByHeader", "type": "->" }, { "file": "/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php", "line": 59, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Barryvdh\\Debugbar\\Middleware\\InjectDebugbar", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php", "line": 21, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php", "line": 31, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php", "line": 21, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php", "line": 40, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\TrimStrings", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php", "line": 27, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php", "line": 99, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php", "line": 39, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 183, "function": "handle", "class": "Illuminate\\Http\\Middleware\\TrustProxies", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 119, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", "line": 175, "function": "then", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", "line": 144, "function": "sendRequestThroughRouter", "class": "Illuminate\\Foundation\\Http\\Kernel", "type": "->" }, { "file": "/public/index.php", "line": 51, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Kernel", "type": "->" }, { "file": "/Applications/Herd.app/Contents/Resources/valet/server.php", "line": 155, "function": "require" } ] }``` ### Steps to reproduce 1. Install 2. Configure and ensure working on a form (Enabled state for Form A) 3. Create Form B, but do not enable MailChimp 4. Submit Form B - see the error. ### Environment Environment Application Name: Laravel Version: 10.48.20 PHP Version: 8.3.10 Composer Version: 2.7.7 Environment: local Debug Mode: ENABLED URL: Maintenance Mode: OFF Cache Config: NOT CACHED Events: NOT CACHED Routes: NOT CACHED Views: CACHED Drivers Broadcasting: log Cache: file Database: mysql Logs: stack / single Mail: smtp Queue: sync Session: file Statamic Addons: 8 Sites: 1 Stache Watcher: Enabled Static Caching: Disabled Version: 5.23.0 PRO Statamic Addons aryehraber/statamic-captcha: 1.12.1 mitydigital/feedamic: 2.5.0 mitydigital/goodness-gravel: dev-main mitydigital/iconamic: 2.2.2 mitydigital/sitemapamic: 3.2.0 mitydigital/statamic-google-fonts: 2.0.0 mitydigital/supportamic: 1.1.1 statamic-rad-pack/mailchimp: 5.1.1
Thanks for reporting this. It'll be fixed by https://github.com/statamic-rad-pack/mailchimp/pull/127
Description
Following the release of 5.1.0, a bug has been introduced.
The listener, AddFromSubmission, is expecting to call
subscribe()
, however, if a Form does not have MailChimp enabled, theSubscriber::fromSubmission($event->submission)
will return null.This results in this error (paths edited):