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:
/**
     * 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) {

 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi tzmudzinski,

Which version of concrete5 are you using?

Are you using the Form block or a custom form?
serot0nin replied on at Permalink Reply
serot0nin
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:
$values = is_string($value) ? explode(',', $value) : $value;
tzmudzinski replied on at Permalink Reply
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.
MrKDilkington replied on at Permalink Reply
MrKDilkington
@tzmudzinski

Are you using the Form block? If so, is it the new v8 Form block or Legacy Form block?
tzmudzinski replied on at Permalink Reply
yes I'm using the new Legacy Form block. In the Form block everything is ok.
MrKDilkington replied on at Permalink Reply
MrKDilkington
@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.
peejay68 replied on at Permalink Reply
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
MrKDilkington replied on at Permalink Reply
MrKDilkington
@peejay68

I was unable to reproduce the issue using the steps you listed.

I tested using version 8.2.1.
DigitalDesign replied on at Permalink Reply
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.
darrellgw replied on at Permalink Reply
darrellgw
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.
MrKDilkington replied on at Permalink Reply
MrKDilkington
@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
darrellgw replied on at Permalink Reply 2 Attachments
darrellgw
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).
MrKDilkington replied on at Permalink Reply
MrKDilkington
@darrellgw

The error is pointing to an issue with sending mail.

Does this error display every time you submit the Legacy Form block?
darrellgw replied on at Permalink Reply
darrellgw
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.
MrKDilkington replied on at Permalink Reply
MrKDilkington
@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?
darrellgw replied on at Permalink Reply 1 Attachment
darrellgw
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.
MrKDilkington replied on at Permalink Reply
MrKDilkington
@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?
darrellgw replied on at Permalink Reply
darrellgw
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.
ebirt replied on at Permalink Reply 1 Attachment
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...
MrKDilkington replied on at Permalink Reply
MrKDilkington
@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.
xigo replied on at Permalink Reply
I am also getting the above issue on c5.8.2.1 . Has anyone found that upgrading fixes the issue?