Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 500 When Saving a Marketing Message Using "Save and Close" Button #14469

Closed
1 task done
shinde-rahul opened this issue Jan 17, 2025 · 13 comments
Closed
1 task done
Assignees
Labels
bug Issues or PR's relating to bugs good first issue marketing-messages

Comments

@shinde-rahul
Copy link
Contributor

shinde-rahul commented Jan 17, 2025

Mautic Series

6.0.x series

Mautic installed version

6.x

Way of installing

I cloned the Mautic repo (not recommended or supported)

PHP version

8.3.14

What browsers are you seeing the problem on?

No response

What happened?

When attempting to create a marketing message and clicking the "Save and Close" button or opening the details page for marketing message, the following error occurs:

500 Internal Server Error - Expected a scalar value as a 2nd argument to "Symfony\Component\HttpFoundation\InputBag::get()", "array" given.

Proposed Fix

The issue might be resolved by updating the code at the following location:AbstractStandardFormController.php#L769.
Replace the existing line with:

$dateRangeValues = $request->$method->all()['daterange'] ?? [];

How can we reproduce this issue?

Step 1: Go to Marketing Messages.
Step 2: Create a new marketing message by filling in the required details.
Step 3: Click on the "Save and Close" button.
Step 4: Observe the error message displayed.

Relevant log output

mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "Expected a scalar value as a 2nd argument to "Symfony\Component\HttpFoundation\InputBag::get()", "array" given." at /var/www/html/vendor/symfony/http-foundation/InputBag.php line 32 {"exception":"[object] (InvalidArgumentException(code: 0): Expected a scalar value as a 2nd argument to \"Symfony\\Component\\HttpFoundation\\InputBag::get()\", \"array\" given. at /var/www/html/vendor/symfony/http-foundation/InputBag.php:32)
[stacktrace]
#0 /var/www/html/app/bundles/CoreBundle/Controller/AbstractStandardFormController.php(769): Symfony\\Component\\HttpFoundation\\InputBag->get()
#1 /var/www/html/app/bundles/ChannelBundle/Controller/MessageController.php(132): Mautic\\CoreBundle\\Controller\\AbstractStandardFormController->getViewDateRange()
#2 /var/www/html/app/bundles/CoreBundle/Controller/AbstractStandardFormController.php(1131): Mautic\\ChannelBundle\\Controller\\MessageController->getViewArguments()
#3 /var/www/html/app/bundles/ChannelBundle/Controller/MessageController.php(94): Mautic\\CoreBundle\\Controller\\AbstractStandardFormController->viewStandard()
#4 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(181): Mautic\\ChannelBundle\\Controller\\MessageController->viewAction()
#5 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw()
#6 /var/www/html/vendor/symfony/framework-bundle/Controller/AbstractController.php(122): Symfony\\Component\\HttpKernel\\HttpKernel->handle()
#7 /var/www/html/app/bundles/CoreBundle/Controller/CommonController.php(412): Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController->forward()
#8 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(181): Mautic\\CoreBundle\\Controller\\CommonController->executeAction()
#9 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw()
#10 /var/www/html/vendor/symfony/http-kernel/Kernel.php(197): Symfony\\Component\\HttpKernel\\HttpKernel->handle()
#11 /var/www/html/app/AppKernel.php(101): Symfony\\Component\\HttpKernel\\Kernel->handle()
#12 /var/www/html/app/middlewares/CORSMiddleware.php(76): AppKernel->handle()
#13 /var/www/html/app/middlewares/HSTSMiddleware.php(39): Mautic\\Middleware\\CORSMiddleware->handle()
#14 /var/www/html/app/middlewares/CatchExceptionMiddleware.php(28): Mautic\\Middleware\\HSTSMiddleware->handle()
#15 /var/www/html/app/middlewares/Dev/IpRestrictMiddleware.php(52): Mautic\\Middleware\\CatchExceptionMiddleware->handle()
#16 /var/www/html/app/middlewares/VersionCheckMiddleware.php(58): Mautic\\Middleware\\Dev\\IpRestrictMiddleware->handle()
#17 /var/www/html/app/middlewares/TrustMiddleware.php(42): Mautic\\Middleware\\VersionCheckMiddleware->handle()
#18 /var/www/html/app/middlewares/StackedHttpKernel.php(55): Mautic\\Middleware\\TrustMiddleware->handle()
#19 /var/www/html/index.php(19): Mautic\\Middleware\\StackedHttpKernel->handle()
#20 {main}

Code of Conduct

  • I confirm that I have read and agree to follow this project's Code of Conduct
@shinde-rahul shinde-rahul added bug Issues or PR's relating to bugs needs-triage For new issues/PRs that need to be triaged marketing-messages labels Jan 17, 2025
@RCheesley
Copy link
Member

Thanks for flagging up the bug, @shinde-rahul - hopefully an easy one to fix!

@RCheesley RCheesley added good first issue and removed needs-triage For new issues/PRs that need to be triaged labels Jan 20, 2025
@RCheesley RCheesley moved this to 🤔 To Do in Open Source Fridays Jan 20, 2025
@developerluanramos
Copy link

@shinde-rahul Can I get this to develop? Or are you working on it @RCheesley ?

@RCheesley
Copy link
Member

I'm not, @developerluanramos - please go ahead. If it's only affecting 6.0 please make the PR on the 6.x branch. Thanks!

@RCheesley RCheesley moved this from 🤔 To Do to 🏗️ In Progress in Open Source Fridays Jan 31, 2025
@developerluanramos
Copy link

So, lets rock!

@shinde-rahul
Copy link
Contributor Author

I parked this for next week, and it would be great if you, @developerluanramos, could pick it up and get started.

@developerluanramos
Copy link

@shinde-rahul

Great! I will fix it during this weekend.

@developerluanramos
Copy link

@shinde-rahul @RCheesley

Hey guys! Well, I could not find the reported bug. I have tried so many different data combinations in the form, but all of them is right. I created some Marketing Messages to try simulate the bug, but its not happening with me.

Image

Image

Could you provide more information about the last form state with user data when this error ocurred ?

@developerluanramos
Copy link

@shinde-rahul @RCheesley Do you have some news about this?

@RCheesley
Copy link
Member

@developerluanramos are you definitely using the 6.x branch when you're testing?

@developerluanramos
Copy link

@RCheesley yes! I am using the 6.x branch. Take at look this printscreen.

Image

@shinde-rahul
Copy link
Contributor Author

@developerluanramos, I see the bug fixed here: #14489, and it was not tagged for this issue.

@shinde-rahul shinde-rahul moved this from 🏗️ In Progress to 🥳 Done in Open Source Fridays Feb 6, 2025
@shinde-rahul
Copy link
Contributor Author

I am closing this issue.

Copy link
Contributor

github-actions bot commented Feb 6, 2025

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If this issue is continuing with the lastest stable version of Mautic, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues or PR's relating to bugs good first issue marketing-messages
Projects
Status: 🥳 Done
Development

No branches or pull requests

3 participants