FormBuilder Multipart gives Error 500

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
webform
Power Poster
Power Poster
Posts: 466
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

FormBuilder Multipart gives Error 500

Post 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?
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1658
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: FormBuilder Multipart gives Error 500

Post 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.
Not getting the answer you need? CMSMS support options
webform
Power Poster
Power Poster
Posts: 466
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: FormBuilder Multipart gives Error 500

Post 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. ???
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1658
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: FormBuilder Multipart gives Error 500

Post 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.
Not getting the answer you need? CMSMS support options
webform
Power Poster
Power Poster
Posts: 466
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: FormBuilder Multipart gives Error 500

Post 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.
webform
Power Poster
Power Poster
Posts: 466
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: FormBuilder Multipart gives Error 500

Post 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?
webform
Power Poster
Power Poster
Posts: 466
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: FormBuilder Multipart gives Error 500

Post 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.
webform
Power Poster
Power Poster
Posts: 466
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: FormBuilder Multipart gives Error 500

Post by webform »

No! It was not that. Several tests later, where the token was the same on all pages, page 2 still fails.
Post Reply

Return to “Modules/Add-Ons”