solspace / craft-freeform

Freeform for Craft: The most reliable form builder that's ready for wherever your project takes you.
https://docs.solspace.com/craft/freeform/v5/
Other
47 stars 60 forks source link

Submission errror after upgrading freeform 5 #1427

Closed wsteidl closed 3 months ago

wsteidl commented 3 months ago

What happened?

I upgraded freeform recently and now I noticed forms are not working correctly. I am not sure after which version it stopped working but I tested downgrading to 5.4.2 and then my form works again

It is calling this method and it doesn't exist anymore:

Solspace\Freeform\Events\Forms\SendNotificationsEvent::getFields()

Errors and Stack Trace (if available)

2024-07-19 17:11:07 [web.INFO] [yii\mail\BaseMailer::send] Sending email "download form careers" to "xxxxx" {"memory":18792424} 
2024-07-19 17:11:07 [web.ERROR] [yii\base\UnknownMethodException] yii\base\UnknownMethodException: Calling unknown method: Solspace\Freeform\Events\Forms\SendNotificationsEvent::getFields() in /var/www/html/vendor/yiisoft/yii2/base/BaseObject.php:222
Stack trace:
#0 /var/www/html/modules/freeform-module/Module.php(57): yii\base\BaseObject->__call('getFields', Array)
#1 [internal function]: modules\freeformmodule\Module->modules\freeformmodule\{closure}(Object(Solspace\Freeform\Events\Forms\SendNotificationsEvent))
#2 /var/www/html/vendor/yiisoft/yii2/base/Event.php(312): call_user_func(Object(Closure), Object(Solspace\Freeform\Events\Forms\SendNotificationsEvent))
#3 /var/www/html/vendor/solspace/craft-freeform/packages/plugin/src/Bundles/Notifications/NotificationsBundle.php(60): yii\base\Event::trigger('Solspace\\Freefo...', 'send-notificati...', Object(Solspace\Freeform\Events\Forms\SendNotificationsEvent))
#4 [internal function]: Solspace\Freeform\Bundles\Notifications\NotificationsBundle->sendNotifications(Object(Solspace\Freeform\Events\Forms\SendNotificationsEvent))
#5 /var/www/html/vendor/yiisoft/yii2/base/Event.php(312): call_user_func(Array, Object(Solspace\Freeform\Events\Submissions\ProcessSubmissionEvent))
#6 /var/www/html/vendor/solspace/craft-freeform/packages/plugin/src/Services/SubmissionsService.php(204): yii\base\Event::trigger('Solspace\\Freefo...', 'process-submiss...', Object(Solspace\Freeform\Events\Submissions\ProcessSubmissionEvent))
#7 /var/www/html/vendor/solspace/craft-freeform/packages/plugin/src/Services/SubmissionsService.php(174): Solspace\Freeform\Services\SubmissionsService->postProcessSubmission(Object(Solspace\Freeform\Form\Types\Regular), Object(Solspace\Freeform\Elements\Submission))
#8 /var/www/html/vendor/solspace/craft-freeform/packages/plugin/src/controllers/SubmitController.php(46): Solspace\Freeform\Services\SubmissionsService->handleSubmission(Object(Solspace\Freeform\Form\Types\Regular))
#9 [internal function]: Solspace\Freeform\controllers\SubmitController->actionIndex()
#10 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#11 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#12 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('', Array)
#13 /var/www/html/vendor/craftcms/cms/src/web/Application.php(340): yii\base\Module->runAction('freeform/submit', Array)
#14 /var/www/html/vendor/craftcms/cms/src/web/Application.php(641): craft\web\Application->runAction('freeform/submit', Array)
#15 /var/www/html/vendor/craftcms/cms/src/web/Application.php(302): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#16 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#17 /var/www/html/web/index.php(12): yii\base\Application->run()
#18 {main} {"memory":18554688,"exception":"[object] (yii\\base\\UnknownMethodException(code: 0): Calling unknown method: Solspace\\Freeform\\Events\\Forms\\SendNotificationsEvent::getFields() at /var/www/html/vendor/yiisoft/yii2/base/BaseObject.php:222)"}

How can we reproduce this?

Freeform Edition

Pro

Freeform Version

5.5.4

Craft Version

4.10.6

When did this issue start?

After upgrading from older Freeform version

Previous Freeform Version

not sure

wsteidl commented 3 months ago

It was my own fault, I was calling the getFields method myself and had to refactor