Sterc / FormIt

A dynamic form processing Snippet for MODX Revolution
https://docs.modx.com/current/en/extras/formit
33 stars 58 forks source link

Bug on hasHook() #181

Closed lokamaya closed 5 years ago

lokamaya commented 6 years ago

(boolean) function hasHook()

Using strpos() to evaluate hooks is very unreliable, as it is prone to hook collision. For example when using ReCaptchaV2 as hooks, its generates an error because FormIt automatically tries to load the ReCaptcha class.

See MODx Forum thread/103830

Margootje commented 6 years ago

I have the error-message "formit could not load Formit/Recaptcha service class" on/in my website, and found your solution, but when I changed the file ( /core/components/formit/src/FormIt.php) with your suggestion I had to leave the manager. When I wanted to load the manager again I got a blank screen, even after deleting the cache etc. So I changed formit.php back to the old version, there was my manager login again. So what's the right solution of the error that formit can't load the recaptchav2 service class. (modx 2.6.5, php 7.0.3) I'm curious to know.

mintnl commented 6 years ago

Got the same errormessage in my errorlog. I can confirm that this code adaptation works.

jacobkball commented 6 years ago

I've tried updating the code per the thread on the forum, and it did NOT work for me. I've had to just disable the recaptchav2 hook, until such time as this plugin is updated and it works.

Oetzie commented 5 years ago

I refactored a lot in 4.2.0, and included this fix manually. So I close this PR.