Form Error: explode() expects parameter 2 to be string, array given
Permalink
Hello!
I've got a big problem with forms.
I've created a form with two select field. Both of them are multi select.
When I fill the field and click Submit an error occure:
Whoops \ Exception \ ErrorException (E_WARNING)
explode() expects parameter 2 to be string, array given
I've tried on clear installation of Concrete5 and I have the same problem.
Please help!
More information from debugging:
I've got a big problem with forms.
I've created a form with two select field. Both of them are multi select.
When I fill the field and click Submit an error occure:
Whoops \ Exception \ ErrorException (E_WARNING)
explode() expects parameter 2 to be string, array given
I've tried on clear installation of Concrete5 and I have the same problem.
Please help!
More information from debugging:
/** * Used by selectize. Automatically takes a value request and converts it into tag/text key value pairs. * New options are just text/tag, whereas existing ones are SelectAttributeOption:ID/text. */ protected function loadSelectedTagValueFromPost($value) { $em = \Database::get()->getEntityManager(); $r = $em->getRepository('\Concrete\Core\Entity\Attribute\Value\Value\SelectValueOption'); $type = $this->attributeKey->getAttributeKeySettings(); $values = explode(',', $value); $response = array(); foreach ($values as $value) { $value = trim($value); $o = new \stdClass(); if (strpos($value, 'SelectAttributeOption:') === 0) {
Viewing 15 lines of 24 lines. View entire code block.
I'm having the same issue (in version 8.2.1).
Rendering form elements using $ak->render('form', $c->getAttributeValueObject($ak));
The form posts back to the same page.
My workaround is to replace line 559 in the controller with the following:
Rendering form elements using $ak->render('form', $c->getAttributeValueObject($ak));
The form posts back to the same page.
My workaround is to replace line 559 in the controller with the following:
Hi,
I'm using the latest version 8.2.1
I found the same issue on my other page.
There is a form which worked but after update this error occurs.
I'm using the latest version 8.2.1
I found the same issue on my other page.
There is a form which worked but after update this error occurs.
@tzmudzinski
Are you using the Form block? If so, is it the new v8 Form block or Legacy Form block?
Are you using the Form block? If so, is it the new v8 Form block or Legacy Form block?
yes I'm using the new Legacy Form block. In the Form block everything is ok.
@tzmudzinski
I don't see a multi-select drop-down answer type in the Legacy Form block.
Can you list the steps needed to reproduce this and where to enable multi-select drop-downs, please.
I don't see a multi-select drop-down answer type in the Legacy Form block.
Can you list the steps needed to reproduce this and where to enable multi-select drop-downs, please.
Hi I've noticed this using the new Form block (express) when you copy the form to clipboard then try to reuse it on another page. Steps to reproduce:
1. Create a Form with a select field, enter at least 2 options
2. Copy this block to clipboard and paste on a new page
3. Try to submit the copied form on the new page
Ensure php display_errors = on in your php settings
Hope this helps,
Mike
1. Create a Form with a select field, enter at least 2 options
2. Copy this block to clipboard and paste on a new page
3. Try to submit the copied form on the new page
Ensure php display_errors = on in your php settings
Hope this helps,
Mike
@peejay68
I was unable to reproduce the issue using the steps you listed.
I tested using version 8.2.1.
I was unable to reproduce the issue using the steps you listed.
I tested using version 8.2.1.
The error is present on 8.2.1 also when creating a new form. It seems that only certain input fires the error but I have not yet been able to pinpoint when is this exactly happening.
Has there been any resolution to this issue. I am having the same issue on a rather involved form. Keep getting "explode() expects parameter 2 to be string, array given" and not sure where/how the error is being generated.
My form:http://ers-cat.com/careers/
Environment: # concrete5 Version
Core Version - 8.2.1
Version Installed - 8.2.1
Database Version - 20170802000000
UPDATE: Best I can tell, it is either the field set to "Phone" that is required and doesn't like any dashes or periods in the format. I did get the form to process, but still have frequent errors. Probably switching out all Phone fields for text boxes to make it more user friendly.
My form:http://ers-cat.com/careers/
Environment: # concrete5 Version
Core Version - 8.2.1
Version Installed - 8.2.1
Database Version - 20170802000000
UPDATE: Best I can tell, it is either the field set to "Phone" that is required and doesn't like any dashes or periods in the format. I did get the form to process, but still have frequent errors. Probably switching out all Phone fields for text boxes to make it more user friendly.
@darrellgw
I recommend temporarily enabling full debug error, then replying with the full error and a screenshot of it.
Dashboard > System & Settings > Environment > Debug Settings > Error Detail > Show the debug error output
I recommend temporarily enabling full debug error, then replying with the full error and a screenshot of it.
Dashboard > System & Settings > Environment > Debug Settings > Error Detail > Show the debug error output
Thank you for the message. Before I got your message, based on other research I had taken out the address type fields and just replaced with text areas and text fields. Admittedly, not as slick, but read elsewhere this could be an issue. Ran the first test and was successful. Went to test again, and now I got "Allowed memory size of 268435456 bytes exhausted (tried to allocate 19623705580607 bytes)". I will do as you suggest and turn on full debugging.
(Screenshot of error debugging included).
(Screenshot of error debugging included).
@darrellgw
The error is pointing to an issue with sending mail.
Does this error display every time you submit the Legacy Form block?
The error is pointing to an issue with sending mail.
Does this error display every time you submit the Legacy Form block?
No, sometimes the form comes through with no issues. I have only tested a hand-full of times and out of those, only two came through.
@darrellgw
Is there a pattern to when and when it does not error (what fields are filled)?
Are you using any file uploads in the Legacy Form block?
Is there a pattern to when and when it does not error (what fields are filled)?
Are you using any file uploads in the Legacy Form block?
I can't establish a pattern as of yet. The form has a large number of fields and would be hard to establish a pattern. And yes, there is a file upload feature on the form. The files that I have been uploading are either a MS Word doc or a PDF file. They are very small, 12K and 151K respectively. Also, sometimes the file gets uploaded to the backend even though the form processing throws the error. I am going to test more to see if I can get more exact on what this could be.
UPDATE - > The information (partial only) is being written to the backend. Every test shows up in forms, but some lack information, even though it was a required field.
UPDATE - > The information (partial only) is being written to the backend. Every test shows up in forms, but some lack information, even though it was a required field.
@darrellgw
Just to clarify, are you using the Form block or Legacy Form block?
Do you get an error if "Send form submissions to email addresses" is unchecked?
Just to clarify, are you using the Form block or Legacy Form block?
Do you get an error if "Send form submissions to email addresses" is unchecked?
I think it is just the form block. Whatever came out of the box on Version 8.2.1. This form/install is only a few days old and nothing other than a Google ReCaptcha add on has been added. Also, when I click Legacy Forms in the backend it says there are none.
In addition, I just went in and unchecked to email the form results and it worked. However, prior to this I did a test that worked as well. Seems like about 1 in 5 tests work with email enabled. Don't have enough tests under the belt to establish if it works 100% without email checked. However, two tests in a row processed correctly without the email portion.
In addition, I just went in and unchecked to email the form results and it worked. However, prior to this I did a test that worked as well. Seems like about 1 in 5 tests work with email enabled. Don't have enough tests under the belt to establish if it works 100% without email checked. However, two tests in a row processed correctly without the email portion.
I am also getting this error, specifically when trying to select one or more options from a "multiple select" question. Otherwise, there is no error thrown.
I am using the updated (express) forms in concrete5 8.2.1.
Here is a link to one of three pages this error is happening one, along with a debug screen shot.
https://discovernewfields.org/education/schools-and-universities/col...
I am using the updated (express) forms in concrete5 8.2.1.
Here is a link to one of three pages this error is happening one, along with a debug screen shot.
https://discovernewfields.org/education/schools-and-universities/col...
@ebirt
Each new version of concrete5 fixes a lot of bugs, so you might try updating to 8.3.1.
One option would be to make a full site backup, create a mirror of the site, then update the mirror to 8.3.1 to see if the issue persists. This would allow you to test the new version before upgrading your production site.
Each new version of concrete5 fixes a lot of bugs, so you might try updating to 8.3.1.
One option would be to make a full site backup, create a mirror of the site, then update the mirror to 8.3.1 to see if the issue persists. This would allow you to test the new version before upgrading your production site.
I am also getting the above issue on c5.8.2.1 . Has anyone found that upgrading fixes the issue?
Which version of concrete5 are you using?
Are you using the Form block or a custom form?