User Anonymous
Location http://www.example.com/user/register
Referrer http://www.example.com/user
Message array_merge() [function.array-merge]: Argument #2 is not an array in /home/mydir/public_html/drupal-5.1/sites/all/modules/captcha/captcha.module on line 195.

Originally this site was running Drupal 4.7 and captcha worked fine. Started getting this error when I upgraded to drupal 5.1 and captcha 5.x-2.1. Then upgraded to 5.x-2.2 but still no luck.

On Admin>Site Config>Captcha config page, I have
Captcha points for the role anonymous user:
Comment form - Captcha/Math
Contact form - Captcha/Math
Sitewide Contact form - Captcha/Math

I don't have the Form Store module (is that required? it's not listed as a requirement in the .info file)

On the old 4.7 site, I had (and still would like) captcha on the user registration form and user edit form, but I don't see that option anymore.

CommentFileSizeAuthor
#14 captcha.php52.patch1.08 KBmathieu

Comments

skor’s picture

More info:
I don't get this error on my test site which runs PHP 4.4.2/MySQL 4.1.21
I do get it on my production site which runs PHP 5.1.4/MySQL 5.0.24

skor’s picture

For now, I've downgraded my production site to 5.x-1.1.

Any significant downside to that?

leoklein’s picture

Title: Argument#2 not an array in captcha.moudle line 195 » Argument#2 not an array in captcha.module line 195

I've downgraded to 5.x-1.1 as well. Works for me (as far as I can tell).

soxofaan’s picture

If you don't mind trying out patched versions have a look at http://drupal.org/node/153395 , the last version at the time of this writing is at http://drupal.org/node/153395#comment-264105

robomalo’s picture

I changed line 195 from

$form = array_merge($form,$result['form']);

to

$form = array_merge($form,(array)$result['form']);

This seems to work for me. With this change, this is the first release that has worked for our site since 5.x-1.1.

robomalo’s picture

I lied, sorry. I spoke way too soon. I just noticed the error was gone. The entire question is gone now. Going back to 5.x-1.1...

skor’s picture

@soxofaan - I'll have a chance to try out your update later this week (possibly thurs).

It's still not clear to me if the Form Store module is required for the 5.x-2.x branch. It isn't listed as a dependancy in the .info file, but and I'm not sure what to make of this

soxofaan’s picture

@soxofaan - I'll have a chance to try out your update later this week (possibly thurs).

thanks

It's still not clear to me if the Form Store module is required for the 5.x-2.x branch. It isn't listed as a dependancy in the .info file, but and I'm not sure what to make of this

form_store is not required to run the captcha module if its default captcha points (forms where a captcha should be enabled) are all you need. If you want captcha's on other forms, you need form_store and form_collect to collect these forms and add them to the captcha interface.

PS: My rewrite of captcha (http://drupal.org/node/153395#comment-264105) has no dependencies (except drupal ;) ).

skor’s picture

OK, finally got my dev site updated to php5 today, and verified that the error happens with php5 (but not php4)

Should have some time to try the patch tomorrow evening.

skor’s picture

OK, so after updating to php5 to get the error, I downgraded to 5.x-1.1, disabled all captcha points, then upgraded to 5.x-2.2, and re-enabled some of the default captcha points. No errors.

Then I installed the form_store module, and enabled captcha on the account registration form. No errors.

So this bug is simply the result of poor upgrade path. I think I only got it because with 5.x-1.1 I had captcha enabled for new account registrations, which is not supported in 5.x-2.2 without form_store.

Possible solutions

  1. add support in 5.x-2.2 for all the same captcha points that 5.x-1.1 had
  2. on 5.x-2.2 install, disable all captcha points that aren't supported without form_store
  3. better documentation or a message to the user making it clear that form_store is required for certain captcha points that were supported in 5.x-1.1
twohills’s picture

+1 here.

Captcha 5.x-2.2
Drupal 5.x-dev (2007-Jun-20)
I don't think this is an upgrade error. i deleted all captcha variables and re-enabled - still had the problem

This error disables user/password and user/registration forms, even when no captcha point is set for them!

sigfredo’s picture

Hi I hope that this infrmation may help to solve the bug. I have installed Captcha module on my drupal 5.1 site, I got the error Argument#2 not an array in captcha.module line 195his error. It happened wiith PHP 5.2.2. After reviewing the posts here I have downgraded PHP to Version 4.4.7 and the captcha module begin working fine, without problems, and without doing anythisng else you can see it at http://www.transformando.info.

skor’s picture

@twohills - Did you downgrade to captcha 5.x-1.1 before disabling all captchas, and then upgrading to 5.x-2.2? That worked for me. Then once you're back up to 5.x-2.2, you'll need form_store module to get captchas for user/registration and user/password.

Alternatively, you could try just installing the form_store module and see if that fixes it.
Another option (possibly 5.x-3.x) is being worked over here: http://drupal.org/node/153395

mathieu’s picture

Version: 5.x-2.2 » 5.x-3.x-dev
Status: Active » Needs review
StatusFileSize
new1.08 KB

Here's a patch that hopefully solves this bug (it does for me, with PHP 5.2). This patch is agains 5.x-3.x-dev. This is a fairly simple patch, I just hope I read this bug report correctly and that I had the same problem as everybody else.

wundo’s picture

Status: Needs review » Postponed (maintainer needs more info)
robloach’s picture

Priority: Normal » Critical

Do you still experience this with the latest 3.x-dev?

greggles’s picture

fwiw, I don't think this is sitll a problem. I've upgraded recently and didn't experience this problem.

robloach’s picture

Status: Postponed (maintainer needs more info) » Fixed

Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)