Page 1 of 1
FormBuilder Multipart gives Error 500
Posted: Fri Aug 04, 2023 8:28 am
by webform
I've created a multipage form where i get an HTTP ERROR 500 when i click on the back button in the form - But funny enought only on page 2 of the form.
My error log gives me this error:
Code: Select all
PHP Fatal error: Uncaught TypeError: hash_equals(): Argument #1 ($known_string) must be of type string, null given in C:\Apache24\htdocs\prototypes\modules\FormBuilder\classes\CsrfField.class.php:81
The site in on a local server and when i test the form on a commercial host everything works just fine. So i'm thinking i maybe missing to activate something on my local server to get it to work, but what?
Re: FormBuilder Multipart gives Error 500
Posted: Fri Aug 04, 2023 1:09 pm
by DIGI3
You forgot to include your php versions, but I'm guessing your local server is perhaps a newer one than the hosting server. I don't think FormBuilder has been fully updated for PHP 8.1+ yet.
Re: FormBuilder Multipart gives Error 500
Posted: Fri Aug 04, 2023 1:24 pm
by webform
Local server is PHP 8.1.5. Live server was PHP 7.4, when i tested first time but i've upgraded it to PHP 8.1.22 and it still works just fine.

Re: FormBuilder Multipart gives Error 500
Posted: Fri Aug 04, 2023 1:30 pm
by DIGI3
Sorry, that was my best and only guess. It may still be a bug or php8 change needed in the module, but best if you can make it happen on any server before filing a bug report.
Re: FormBuilder Multipart gives Error 500
Posted: Fri Aug 04, 2023 2:26 pm
by webform
It was a good guess and one i've thought my self. Thats why i've tried to upgrade my public host to see if the form would fail.
Re: FormBuilder Multipart gives Error 500
Posted: Mon Aug 28, 2023 12:58 pm
by webform
I've digged down in my Apache Error log and got this:
Code: Select all
[php:error] [pid 3060:tid 1376] [client xxx.xxx.x.xxx:56619] PHP Fatal error: Uncaught TypeError: hash_equals(): Argument #1 ($known_string) must be of type string, null given in
C:\\Apache24\\htdocs\\prototypes\\app\\wet\\modules\\FormBuilder\\classes\\CsrfField.class.php:81\nStack trace:\n#0
C:\\Apache24\\htdocs\\prototypes\\app\\wet\\modules\\FormBuilder\\classes\\CsrfField.class.php(81): hash_equals(NULL, '864cf8347202d99...')\n#1
C:\\Apache24\\htdocs\\prototypes\\app\\wet\\modules\\FormBuilder\\classes\\Form.class.php(612): fbCsrfField->Validate()\n#2
C:\\Apache24\\htdocs\\prototypes\\app\\wet\\modules\\FormBuilder\\action.default.php(116): fbForm->Validate()\n#3
C:\\Apache24\\htdocs\\prototypes\\app\\wet\\lib\\classes\\class.CMSModule.php(1407): include('C:\\\\Apache24\\\\htd...')\n#4
C:\\Apache24\\htdocs\\prototypes\\app\\wet\\modules\\FormBuilder\\FormBuilder.module.php(210): CMSModule->DoAction('default', 'cntnt01', Array, '54')\n#5
C:\\Apache24\\htdocs\\prototypes\\app\\wet\\lib\\classes\\class.CMSModule.php(1483): FormBuilder->DoAction('default', 'cntnt01', Array, '54')\n#6
C:\\Apache24\\htdocs\\prototypes\\app\\wet\\lib\\page.functions.php(550): CMSModule->DoActionBase('default', 'cntnt01', Array, '54', Object(Smarty_CMS))\n#7
C:\\Apache24\\htdocs\\prototypes\\app\\wet\\index.php(156): preprocess_mact('54')\n#8 {main}\n thrown in
C:\\Apache24\\htdocs\\prototypes\\app\\wet\\modules\\FormBuilder\\classes\\CsrfField.class.php on line 81, referer: https://dev.mydomain.dk/prototypes/index.php?page=test
It looks like it's the validating of the CSRF Token in a multipart form, that gives me some problemes on my local server, when i click back in the form.
But it works on a commercial host server, so i belive i need to change some settings in my local php.ini file but what settings?
Re: FormBuilder Multipart gives Error 500
Posted: Mon Aug 28, 2023 1:12 pm
by webform
I just discovered that the CSRF token value for page 2 is different from the other pages in the form.
That can explain why it is always page 2 that triggers the server error.
Re: FormBuilder Multipart gives Error 500
Posted: Mon Aug 28, 2023 1:36 pm
by webform
No! It was not that. Several tests later, where the token was the same on all pages, page 2 still fails.