Hi,

This message always appear on the registration page:warning: preg_match() expects parameter 2 to be string, array given in /includes/bootstrap.inc on line 6

The upload picture system is enable during registration but when uploaded, there is no more picture and it is allways the default picture that is showing.

Comments

sbandyopadhyay’s picture

Title: warning: preg_match() expects parameter 2 to be string, array given in /includes/bootstrap.inc on line 6 » $form['#attributes']['enctype'] unneeded in some cases?

I had the same error, and crafted a potential solution. Using the devel module, I traced the error that I got as follows:
* warning: preg_match() expects parameter 2 to be string, array given in /includes/bootstrap.inc on line 670.
* preg_match
* file/line: /includes/bootstrap.inc: 670
* arguments: /^./us,

Array
(
    [0] => multipart/form-data
    [1] => multipart/form-data
)

That second argument is an array, and as the error we're getting so handily notified us, it should be a string. Tracing back further, I found:
* drupal_attributes
* file/line: /includes/form.inc: 1433
* arguments:

Array
(
    [enctype] => Array
        (
            [0] => multipart/form-data
            [1] => multipart/form-data
        )

)

The desired string ("multipart/form-data") is somehow being written in twice. I don't have the time to figure out how or why, but in the hopes that it would fix it, I commented out the line $form['#attributes']['enctype'] = 'multipart/form-data'; in reg_with_pic.module...

And that fixed it!

This clearly may not be a universal solution. But it worked for me, so hopefully that will help.

eclypse’s picture

I've tried to comment these lines and it worked. So thanks a lot.

I searched in the code and It looks like it was the nodeprofile module that caused me this problem. By removing a nodeprofile form in the register page, it resolved the problem. And with that form enabled, I had to comment the lines that you've described above. So, problem of interraction between nodeprofile and this mobule.

Thank you for your contribution.

sbandyopadhyay’s picture

I can back that up-- I am running nodeprofile too. Looks like instead of commenting that out, maybe it could check to see if nodeprofile is activated and then act accordingly.

eclypse’s picture

Status: Fixed » Active
eclypse’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Active » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.