KonstantinCodes / mautic-recaptcha

This Plugin brings reCAPTCHA integration to mautic.
GNU General Public License v3.0
50 stars 29 forks source link

Plugin throws 500 error #24

Closed orbis86 closed 3 years ago

orbis86 commented 4 years ago

Hello

I tried to use the plugin but it won't even get to the part where I can go and install it. After unzipping it and changing the name and clearing the Cache - the application throws a 500 error. Removing the plugin and clearing the cache again gets rid of the error. Could you please help?

The error that I Found is below

[19-Apr-2020 07:58:38 UTC] PHP Warning - "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - in file /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php - at line 2636 [19-Apr-2020 07:58:38 UTC] PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2636 [19-Apr-2020 07:58:38 UTC] PHP Warning - "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - in file /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php - at line 2665 [19-Apr-2020 07:58:38 UTC] PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2665 [19-Apr-2020 07:58:39 UTC] PHP Warning - "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - in file /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php - at line 2636 [19-Apr-2020 07:58:39 UTC] PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2636 [19-Apr-2020 07:58:39 UTC] PHP Warning - "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - in file /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php - at line 2665 [19-Apr-2020 07:58:39 UTC] PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2665 [19-Apr-2020 07:58:50 UTC] PHP Warning - "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - in file /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php - at line 2636 [19-Apr-2020 07:58:50 UTC] PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2636 [19-Apr-2020 07:58:50 UTC] PHP Warning - "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - in file /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php - at line 2665 [19-Apr-2020 07:58:50 UTC] PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2665 [19-Apr-2020 07:58:52 UTC] PHP Warning - "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - in file /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php - at line 2636 [19-Apr-2020 07:58:52 UTC] PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2636 [19-Apr-2020 07:58:52 UTC] PHP Warning - "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - in file /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php - at line 2665 [19-Apr-2020 07:58:52 UTC] PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2665 [19-Apr-2020 07:59:00 UTC] PHP Warning - "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - in file /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php - at line 2636 [19-Apr-2020 07:59:00 UTC] PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2636 [19-Apr-2020 07:59:00 UTC] PHP Warning - "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - in file /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php - at line 2665 [19-Apr-2020 07:59:00 UTC] PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2665 [19-Apr-2020 07:59:48 UTC] PHP Warning - "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - in file /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php - at line 2636 [19-Apr-2020 07:59:48 UTC] PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2636 [19-Apr-2020 07:59:48 UTC] PHP Warning - "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - in file /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php - at line 2665 [19-Apr-2020 07:59:48 UTC] PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2665 [19-Apr-2020 08:01:11 UTC] PHP Warning - "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - in file /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php - at line 2636 [19-Apr-2020 08:01:11 UTC] PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2636 [19-Apr-2020 08:01:11 UTC] PHP Warning - "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - in file /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php - at line 2665 [19-Apr-2020 08:01:11 UTC] PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /location-of-mautic-root/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2665

leolage commented 4 years ago

error 500 here too, I'm using Mautic v2.16.2

[2020-05-05 13:52:01] mautic.NOTICE: Symfony\Component\Debug\Exception\FatalThrowableError: Type error: Argument 1 passed to Mautic\PluginBundle\Integration\AbstractIntegration::__construct() must be an instance of Mautic\CoreBundle\Factory\MauticFactory or null, instance of Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher given, called in /home/marketing/public_html/mautic/app/cache/prod/appProdProjectContainer.php on line 12492 (uncaught exception) at /home/marketing/public_html/mautic/app/bundles/PluginBundle/Integration/AbstractIntegration.php line 208 while running console command mautic:segments:update [] []

[2020-05-05 10:52:03] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Type error: Argument 1 passed to Mautic\PluginBundle\Integration\AbstractIntegration::construct() must be an instance of Mautic\CoreBundle\Factory\MauticFactory or null, instance of Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher given, called in /home/marketing/public_html/mautic/app/cache/prod/appProdProjectContainer.php on line 12492" at /home/marketing/public_html/mautic/app/bundles/PluginBundle/Integration/AbstractIntegration.php line 208 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Type error: Argument 1 passed to Mautic\PluginBundle\Integration\AbstractIntegration::construct() must be an instance of Mautic\CoreBundle\Factory\MauticFactory or null, instance of Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher given, called in /home/marketing/public_html/mautic/app/cache/prod/appProdProjectContainer.php on line 12492 at /home/marketing/public_html/mautic/app/bundles/PluginBundle/Integration/AbstractIntegration.php:208)"} []

KonstantinCodes commented 4 years ago

Hi there, for mautic 2, you have to use the tag 1.1.3. I have updated the installation instructions in in the readme.

Thank you @i8ntech and @leolage

ikolubr commented 4 years ago

I would reopen this issue.

PHP 7.3 Followed the install downloading the file for Mautic 2.16.2 (1.1.3 version)

These are the errors:

[2020-05-06 15:52:20] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Type error: Argument 1 passed to Mautic\PluginBundle\Integration\AbstractIntegration::construct() must be an instance of Mautic\CoreBundle\Factory\MauticFactory or null, instance of Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher given, called in /var/www/siteFolder/htdocs/app/cache/prod/appProdProjectContainer.php on line 12484" at /var/www/siteFolder/htdocs/app/bundles/PluginBundle/Integration/AbstractIntegration.php line 208 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Type error: Argument 1 passed to Mautic\PluginBundle\Integration\AbstractIntegration::construct() must be an instance of Mautic\CoreBundle\Factory\MauticFactory or null, instance of Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher given, called in /var/www/siteFolder/htdocs/app/cache/prod/appProdProjectContainer.php on line 12484 at /var/www/siteFolder/htdocs/app/bundles/PluginBundle/Integration/AbstractIntegration.php:208)"} [] [2020-05-06 15:53:26] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Type error: Argument 1 passed to Mautic\PluginBundle\Integration\AbstractIntegration::construct() must be an instance of Mautic\CoreBundle\Factory\MauticFactory or null, instance of Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher given, called in /var/www/siteFolder/htdocs/app/cache/prod/appProdProjectContainer.php on line 12484" at /var/www/siteFolder/htdocs/app/bundles/PluginBundle/Integration/AbstractIntegration.php line 208 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Type error: Argument 1 passed to Mautic\PluginBundle\Integration\AbstractIntegration::construct() must be an instance of Mautic\CoreBundle\Factory\MauticFactory or null, instance of Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher given, called in /var/www/siteFolder/htdocs/app/cache/prod/appProdProjectContainer.php on line 12484 at /var/www/siteFolder/htdocs/app/bundles/PluginBundle/Integration/AbstractIntegration.php:208)"} [] [2020-05-06 15:54:47] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function getSession() on null" at /var/www/siteFolder/htdocs/app/bundles/CoreBundle/EventListener/CoreSubscriber.php line 381 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Call to a member function getSession() on null at /var/www/siteFolder/htdocs/app/bundles/CoreBundle/EventListener/CoreSubscriber.php:381)"} [] [2020-05-06 16:01:33] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Type error: Argument 1 passed to Mautic\PluginBundle\Integration\AbstractIntegration::construct() must be an instance of Mautic\CoreBundle\Factory\MauticFactory or null, instance of Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher given, called in /var/www/siteFolder/htdocs/app/cache/prod/appProdProjectContainer.php on line 12484" at /var/www/siteFolder/htdocs/app/bundles/PluginBundle/Integration/AbstractIntegration.php line 208 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Type error: Argument 1 passed to Mautic\PluginBundle\Integration\AbstractIntegration::construct() must be an instance of Mautic\CoreBundle\Factory\MauticFactory or null, instance of Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher given, called in /var/www/siteFolder/htdocs/app/cache/prod/appProdProjectContainer.php on line 12484 at /var/www/siteFolder/htdocs/app/bundles/PluginBundle/Integration/AbstractIntegration.php:208)"} [] [2020-05-06 16:01:40] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Type error: Argument 1 passed to Mautic\PluginBundle\Integration\AbstractIntegration::construct() must be an instance of Mautic\CoreBundle\Factory\MauticFactory or null, instance of Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher given, called in /var/www/siteFolder/htdocs/app/cache/prod/appProdProjectContainer.php on line 12484" at /var/www/siteFolder/htdocs/app/bundles/PluginBundle/Integration/AbstractIntegration.php line 208 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Type error: Argument 1 passed to Mautic\PluginBundle\Integration\AbstractIntegration::construct() must be an instance of Mautic\CoreBundle\Factory\MauticFactory or null, instance of Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher given, called in /var/www/siteFolder/htdocs/app/cache/prod/appProdProjectContainer.php on line 12484 at /var/www/siteFolder/htdocs/app/bundles/PluginBundle/Integration/AbstractIntegration.php:208)"} [] [2020-05-06 16:01:43] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Type error: Argument 1 passed to Mautic\PluginBundle\Integration\AbstractIntegration::construct() must be an instance of Mautic\CoreBundle\Factory\MauticFactory or null, instance of Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher given, called in /var/www/siteFolder/htdocs/app/cache/prod/appProdProjectContainer.php on line 12484" at /var/www/siteFolder/htdocs/app/bundles/PluginBundle/Integration/AbstractIntegration.php line 208 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Type error: Argument 1 passed to Mautic\PluginBundle\Integration\AbstractIntegration::construct() must be an instance of Mautic\CoreBundle\Factory\MauticFactory or null, instance of Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher given, called in /var/www/siteFolder/htdocs/app/cache/prod/appProdProjectContainer.php on line 12484 at /var/www/siteFolder/htdocs/app/bundles/PluginBundle/Integration/AbstractIntegration.php:208)"} []

ikolubr commented 4 years ago

@KonstantinCodes, I changed to PHP 7.2 and it did the trick. If it is related, I don't know. FYI.

dpnascimento commented 4 years ago

Got the same errors here.

KonstantinCodes commented 4 years ago

@KonstantinCodes, I changed to PHP 7.2 and it did the trick. If it is related, I don't know. FYI.

Thank You! There would be a quick fix - to disable warnings in your php.ini. You'd have to find the path to your php.ini:

php --ini

And then find the config value error_reporting and change it to:

error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING

This is only a quick fix of course. The actual problem is a combination of running a newer PHP version (7.3 and up) and old mautic code.

So the issue is actually not in the mautic-recaptcha plugin, but in your outdated mautic installation.

Of course I understand that upgrading mautic comes with problems of its own, and maybe you'd prefer to just disable the warning message.

skwdenyer commented 4 years ago

So, I have a problem with Mautic v3.0.0 + PHP 7.3 - I think that's reasonably up-to-date :)

If I add the mautic-recaptcha plugin and clear the cache, then I get this in the Mautic logs:

[2020-06-24 19:36:30] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Type error: Too few arguments to function Mautic\PluginBundle\Integration\AbstractIntegration::construct(), 15 passed in /home/merlin/public_html/mm/var/cache/prod/ContainerC7oe9dl/getMautic_Integration_RecaptchaService.php on line 8 and exactly 16 expected" at /home/merlin/public_html/mm/app/bundles/PluginBundle/Integration/AbstractIntegration.php line 204 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Type error: Too few arguments to function Mautic\PluginBundle\Integration\AbstractIntegration::construct(), 15 passed in /home/merlin/public_html/mm/var/cache/prod/ContainerC7oe9dl/getMautic_Integration_RecaptchaService.php on line 8 and exactly 16 expected at /home/merlin/public_html/mm/app/bundles/PluginBundle/Integration/AbstractIntegration.php:204)"} []

This repeats. This causes Mautic not to run at all.

Removing the plugin folder and wiping the cache restores the system to health.

Can you assist? Thanks!

dhmusman commented 4 years ago

@skwdenyer are you have found the solition, I am facing same issue. 1 - Update Mautic 2 to 3 issue was coming. 2 - I have done fresh install Mautic 3.0.1 still issue is there.

ronald070 commented 4 years ago

Hello, Thought I let you guys know. I have the same problem. Unable to install the mautic-recaptcha-master.zip file. Cause 500 error site is not working any more. After remove the plugin mautic-recaptcha and clear cache site is working again.

I run mautic v 3.0.1 and php 7.2.

abertay-university commented 4 years ago

Found a solution for me. Update the plugins/MauticRecaptchaBundle/Config/config.php file and add the DoNotContact model to the integrations. 'integrations' => [ 'mautic.integration.recaptcha' => [ 'class' => \MauticPlugin\MauticRecaptchaBundle\Integration\RecaptchaIntegration::class, 'arguments' => [ 'event_dispatcher', 'mautic.helper.cache_storage', 'doctrine.orm.entity_manager', 'session', 'request_stack', 'router', 'translator', 'logger', 'mautic.helper.encryption', 'mautic.lead.model.lead', 'mautic.lead.model.company', 'mautic.helper.paths', 'mautic.core.model.notification', 'mautic.lead.model.field', 'mautic.plugin.model.integration_entity', 'mautic.lead.model.dnc', ], ], ],

Note the addition of mautic.lead.model.dnc at the end

Be sure to clear the cache after making the change

I hope this helps for you @ronald070 @dhmusman @skwdenyer @dpnascimento

jrmarins commented 4 years ago

Found a solution for me. Update the plugins/MauticRecaptchaBundle/Config/config.php file and add the DoNotContact model to the integrations. 'integrations' => [ 'mautic.integration.recaptcha' => [ 'class' => \MauticPlugin\MauticRecaptchaBundle\Integration\RecaptchaIntegration::class, 'arguments' => [ 'event_dispatcher', 'mautic.helper.cache_storage', 'doctrine.orm.entity_manager', 'session', 'request_stack', 'router', 'translator', 'logger', 'mautic.helper.encryption', 'mautic.lead.model.lead', 'mautic.lead.model.company', 'mautic.helper.paths', 'mautic.core.model.notification', 'mautic.lead.model.field', 'mautic.plugin.model.integration_entity', 'mautic.lead.model.dnc', ], ], ],

Note the addition of mautic.lead.model.dnc at the end

Be sure to clear the cache after making the change

I hope this helps for you @ronald070 @dhmusman @skwdenyer @dpnascimento

It worked here perfectly, thanks. Mautic 3.0.1

KonstantinCodes commented 4 years ago

@abertay-university Thank you! I have released a new version with your fix. https://github.com/KonstantinCodes/mautic-recaptcha/releases/tag/3.0.1