First of all, after going to the registration page, I get this in my apache error log:

[error] PHP Fatal error: Cannot use string offset as an array in /sites/all/modules/captcha/captcha.module on line 166

thus, I can not reach the registration page...

And on the "Administer / Site configuration / Captcha" page, the "Captcha Points" tab shows nothing, it's empty.

--
Daniel

Comments

BryanSD’s picture

I'm seeing the same error here too. For me this is an upgrade from a previous version of captcha.

Farreres’s picture

same problem here.

VDG’s picture

I got this module working by changing the "+=" on line 194 into ".=". Captcha points never show up, but you can add some more in the function _captcha_points(). Change "if($captcha_points == NULL)" in the same function to "if($captcha_points != NULL)" and load the captcha-settings page. All additions should be configurable. Now change the "!=" back to "==" and you're set to go.

VDG’s picture

OK, seems all this is not necessary. You just need the "form store" module to get the captcha points right. Only problem now is the captcha never seems to validate...

VDG’s picture

OK, got it working:
- Get the "form store" module and make it add the necessary fields
- If you use the guestbook-module, then go to your database, "variable" table, "name" field and change the type to at least varchar(52) or some name fields will not fit
- Change guestbook_form_entry_form_submit to guestbook_form_entry_form_validate in guestbook.module (really messy, I know)
Now you should be able to add some captcha points.

pyutaros’s picture

So is the general consenus here that the only way to get version 2.0 working is by installing another module?

Farreres’s picture

If installing another module is the way to go, the dependency should be marked in the module info file.

VDG’s picture

Correct. I only found out by accident (looking for the string "captcha" on the modules page). An update of the captcha-page could be handy as well.
As for the line 166 issue, you might have better luck applying this patch.

WebWeasel’s picture

I'm getting "Fatal error: Unsupported operand types in /var/www/htdocs/drupal5/sites/all/modules/captcha/captcha.module on line 194" on any page that tries to display a captcha.

GoofyX’s picture

WebWeasel, see comment #3.

VDG’s picture

Actually, you don't need to change the code, just installing form_store should be enough - as long as you don't use the guestbook module.

GoofyX’s picture

But the += is wrong, right? Shouldn't it be .= ?

VDG’s picture

No, I'm using it almost 'as is' without any problems. The only thing I changed, is this patch, which should not be related to your issue. This patch should also prevent "indefinite" dissapearance of the captcha after the first correct answer.

Farreres’s picture

Please, could this patch be applied and a new corrected official version be created?

GoofyX’s picture

OK, using VDG's patch seems to work along with the form store module. There's no need to change the += operator to .= in line 197 (version 2.1).

However, in case the contact core module is enabled and you try to contact a user from his profile by clicking on the Contact tab, then you get the "Unsupported operand types" error.

mgifford’s picture

Title: 2.0 is not working » Unsupported operand types aren't helpful

This change helps avoid the white screen of death that you get with an unsuported operand type:
http://drupal.org/node/145509

However there does need to be a better solution as captcha just isn't working for me (and from the sounds of it for a lot of other folks too).

Mike

pobster’s picture

+= is perfectly valid php;

$var = 5;
print "Original value: " . $var . "<br />";
// These examples are the same
$var = $var + 1;
print "First example:  " . $var . "<br />";
$var += 1;
print "Second example: " . $var;

Pobster

mgifford’s picture

Yes, but your example is with variables and not with arrays. I haven't been able to track down why this unsupported operand types error is coming up, but it does and it is bringing my site down when I use captcha (and other folks too). I think the problem is either to do with the value not being set before hand or trying to add a string to an array.

BradM’s picture

All this talk sounds like Greek to those of us non-coders. Reverting back to and older version until this mess can be figured out.

mgifford’s picture

I added in the latest form_store module and that seemed to have straightened out the issues I was having.

Mike

RobLoach’s picture

Status: Active » Fixed

Fixed in the 3.x branch.

Anonymous’s picture

Status: Fixed » Closed (fixed)