DavidMarquezF / osTicket-google-recaptcha

3 stars 2 forks source link

Error 500 if captcha box is not ticked #4

Closed bigheadsmith closed 1 year ago

bigheadsmith commented 2 years ago

If the user does not tick the captcha box, instead of alerting the user it still tries to create the ticket but produces an internal server error.

mod_fcgid: stderr:   thrown in public_html/include/class.forms.php on line 688, referer: https://example.com/open.php

mod_fcgid: stderr: PHP Fatal error:  Uncaught Error: Call to undefined method DynamicFormEntry::addError() in public_html/include/class.forms.php:688, referer: https://example.com/open.php

mod_fcgid: stderr: Stack trace:, referer: https://example.com/open.php

mod_fcgid: stderr: #0 public_html/include/plugins/recaptchav2/recaptcha.php(33): FormField->addError('Your response d...'), referer: https://example.com/open.php

mod_fcgid: stderr: #1 public_html/include/class.forms.php(664): reCaptchaField->validateEntry(false), referer: https://example.com/open.php

mod_fcgid: stderr: #2 public_html/include/class.forms.php(920): FormField->getClean(), referer: https://example.com/open.php

mod_fcgid: stderr: #3 public_html/include/class.dynamic_forms.php(1189): FormField->getFilterData(), referer: https://example.com/open.php

mod_fcgid: stderr: #4 public_html/include/class.ticket.php(3972): DynamicFormEntry->getFilterData(), referer: https://example.com/open.php

mod_fcgid: stderr: #5 public_html/include/class.ticket.php(4173): Ticket::filterTicketData('Web', Array, Array, NULL, false), referer: https://example.com/open.php

mod_fcgid: stderr: #6 public_html/open.php(45): Ticket::create(Array, Array, 'Web'), referer: https://example.com/open.php

mod_fcgid: stderr: #7 {main}, referer: https://example.com/open.php

mod_fcgid: stderr:   thrown in public_html/include/class.forms.php on line 688, referer: https://example.com/open.php
DavidMarquezF commented 2 years ago

image

For me it works. What version of OsTickets are you using and have you made sure you configured the plugin correctly?

coder66 commented 2 years ago

This is for 1.16.x releases, throws an internal server error 500 when the plugin is active (running on PHP8.0). Please fix so that the plugin can be used again.

DavidMarquezF commented 1 year ago

I am unable to reproduce this issue on my side. Make sure that the input is marked as required. Also, check if it works with the latest version, which is compatible with osTickets 1.17

I'll close the issue because I cannot reproduce it in any way. If this still happens in the new version and you know how to replicate it, feel free to reopen it

ProbablePrime commented 1 month ago

This was happening recently on our OSTicket instance. The stack trace is below:

PHP Fatal error:  Uncaught OrmException: DynamicFormEntry: addError: Field not defined in /home/moderation/html/include/class.orm.php:413
Stack trace:
#0 /home/moderation/html/include/class.orm.php(417): VerySimpleModel->get()
#1 /home/moderation/html/include/class.forms.php(733): VerySimpleModel->__get()
#2 /home/moderation/html/include/plugins/recaptchav2/recaptcha.php(31): FormField->addError()
#3 /home/moderation/html/include/class.forms.php(704): reCaptchaField->validateEntry()
#4 /home/moderation/html/include/class.dynamic_forms.php(1360): FormField->getClean()
#5 /home/moderation/html/include/class.dynamic_forms.php(1316): DynamicFormEntry->saveAnswers()
#6 /home/moderation/html/include/class.ticket.php(4399): DynamicFormEntry->save()
#7 /home/moderation/html/open.php(45): Ticket::create()
#8 {main}\n  thrown in /home/moderation/html/include/class.orm.php on line 413, referer: https://moderation.resonite.com/open.php

It was preventing ticket opens so, I temporarily commented out the line in question, nothing seems broken. But incorrect captcha's probably won't render correctly.

DavidMarquezF commented 1 month ago

@ProbablePrime what version of Ostickets and of the plugin are you using?

ProbablePrime commented 3 weeks ago

@DavidMarquezF Thank you for your patience.

Looks like we are down-rev a few versions, I see 0.2 for your plugin and v1.17.2 for osticket.

Based on your commits for the plugin, I need to update it.

I apologize for posting on this ancient issue, I'll get things updated when I can and let you know.

Thanks!

DavidMarquezF commented 3 weeks ago

I'm currently using it in production with v0.5 (just released today) and osTickets 1.17.

0.5 fixes a very stupid issue where I was not sending the private key, which for some reason hadn't given me any problems until a few days ago. It has never crashed for me though (and 0.2 is from 2022), I'm curious as to why that might be

ProbablePrime commented 3 weeks ago

Ours was sudden too. Perhaps Google changed stuff in a way that finally broke an older version?

DavidMarquezF commented 3 weeks ago

The stack trace you shared seems more like a ostickets issue though. Maybe there is some changes between 1.17 and 1.17.5 that causes that. The issue that appeared for me was just that the user could never submit the form because google recaptcha returned an http error.

In your case i would recommend removing the plugin and the form fields that used it and adding it again (with trhe new version). If you still have issues with 1.17.5, try 1.17 and let me know if the issue persists. If it does, they probably changed some of the ostickets functions and i just need to update the plugin to adapt to them