After enabling the module, at the comment submission form:
Fatal error: Cannot use string offset as an array in captcha.module on line 416
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | fatalerror_stringoffset_asarray.patch | 880 bytes | soxofaan |
| #20 | captcha_debug.txt | 4.05 KB | Anonymous (not verified) |
Comments
Comment #1
archetwist commentedForgot to write that I use PHP 5.
Comment #2
soxofaan commentedCan you give more (step by step) info to reproduce the bug?
I can't reproduce it (with PHP 5.1.6, Apache 2, Drupal 5.2, captcha HEAD)
Comment #3
spyderpie commentedI have the same error. PHP5, Apache2, Drupal 5.2.
Except mine says line 257.
I enabled the captcha and image captcha modules. (Not text captcha) and then set the config as follows: (Forgive me I don't remember exactly the wording ... and can't get back there)
I checked the box to use captcha on forms and selected the register and password forms. I unselected the persistent captcha box, saved and went to the image captcha form. There i told it to use the text image captcha option. When i logged out and then selected 'forgot my password', I saw the image with the word 'dirt' in it. Then i hit refresh to see it change and this is where the error appeared.
I then logged in as administrator and now the site it completed unavailable. Everything I click gives that error. Even if I manually type /admin/settings in the url.
Thank goodness i tested it on a test site ... but if I didn't I would be in a 'site down' mode :)
Julie
Comment #4
spyderpie commentedAn update:
Line 257 in the actual captcha.module has nothing to do with it .. I know cause I rem'd it out and nothing happened.
The good news is that if you go into the system table, and disable all three captcha modules, captcha, text captcha and image captcha - you will be able to get back into the site.
I went back to admin/build/modules and activated all three this time, then configured it to use image_captcha -- all other settings the same ... all is well ...
Could it be because I had not enabled the text captcha but told it to use textimage?
Julie
Comment #5
soxofaan commented@spyderpie
Do you mean with 'textimage' the textimage module at http://drupal.org/project/textimage ?
The text captcha submodule (included with the captcha module tarball) has nothing to do with textimage stuff.
So if I understand you correctly you use captcha-5.x-3.0-rc1 + the textimage module (version 5.x-1.2?). Textimage is not guaranteed to work with the new reworked core captcha module whatsoever because the captcha API changed.
Comment #6
spyderpie commentedwooooooooooooooooooow
interesting.
I have just disabled the text image module, since I don't need it. Amazing how you forget as you build over time, what you put there and why! LOL
1 less module is always good!
Anyways, i wonder if that is the same problem that archetwist had ... ??
Thanks for being responsive and patience of course.
Julie
Comment #7
robloachDoes this problem still persist?
Comment #8
robloachClosing the issue as no one has reported it.
Comment #9
Anonymous (not verified) commentedUnfortunately, too early to close - I have to report this problem with the latest rc3. When enabled, captcha will invariably display the same error :
Fatal error: Cannot use string offset as an array in /path/to/drupal/sites/all/modules/captcha/captcha.module on line 311
... but only when visitors are coming with the Konqueror web browser! I have tried with firefox on same conditions (i.e. not logged in) and it works without any problem. If the module is uninstalled, Konqueror users have no problem coming to my page.
Very weird.
Comment #10
robloachDo you experience this with 5.x-3.x-dev? What code is at line 311 of captcha.module?
Comment #11
soxofaan commentedline 311 of captcha.module from DRUPAL-5--3-0-rc3 reads:
My guess: Gnurou using PHP4 and cookies are disabled in konqueror. is this correct?
If I disable cookies in konqueror and try to submit a CAPTCHA enabled form I get:
but that's with PHP 5.1.6
Comment #12
robloachThink we should provide a better descriptions then "Invalid captcha token."?
Comment #13
Anonymous (not verified) commentedActually I'm using PHP5 and cookies were enabled. But the weird thing is that I tried on another machine (still using Konqueror) and it works flawlessly. I'll try again with the -dev version.
The weirdest thing being that actually the page that triggers the error is the home page, which does not display any catcha. I think others page would not work neither, I'll try to confirm this once I return to the faulty Konqueror instance.
Comment #14
soxofaan commentedIt is indeed a bit cryptic.
Some causes for the error I can think of right now:
What about: "Unable to retrieve your CAPTCHA data."?
or "Unable to retrieve your CAPTCHA data. Possible causes: cookies are disabled, you tried to re-post the form, CAPTCHA API mismatch."?
Comment #15
Anonymous (not verified) commentedUsing 5.x-3.x-dev, the error still appears, this time only when I load pages where captcha appears:
Fatal error: Cannot use string offset as an array in
/path/to/drupal/sites/all/modules/captcha/captcha.module on line
583
Line 583 reads:
$_SESSION['captcha'][$form_id][$captcha_token] = $form['captcha']['captcha_solution']['#value'];
Strange thing is that, once again, this problem only appears on ONE instance of Konqueror (that I use home). On another machine, even though the same distro, same version is installed (Kubuntu Feisty), I don't have this problem. I really don't understand how this can be.
Comment #16
soxofaan commentedWeird indeed.
Can you give more information on:
* the versions of PHP, Apache, Konqueror, Drupal, ...?
* your website setup: shared host, running on localhost, working with proxies?
* which CAPTCHA type do you use?
* did you try other CAPTCHA types?
* what other possibly relevant modules are enabled?
Comment #17
soxofaan commentedat #15:
can you put
before that line 583 and post the stuff it spits out? (use text attachement)
I've googled for the error and found following interesting information:
http://www.zend.com/forums/index.php?t=msg&goto=6396#msg_num_4
http://bugs.php.net/bug.php?id=32621
Comment #18
robloachIf you have the Devel module installed, you can use:
I've found that very handy for debugging.
Comment #19
soxofaan commentedat #18:
the devel module provides a even shorter way to do that:
very handy indeed (I use it all the time).
But I assumed that Gnurou did not have the devel module installed, so I thought the var_dump() trick would be the easiest way to get that data.
Comment #20
Anonymous (not verified) commentedHere is the requested information:
My server runs Ubuntu Feisty
* PHP is 5.2.1
* Apache is 2.2.3
* Drupal is 5.2
* Konqueror is 3.5.6
The server is a virtual dedicated (User Mode Linux), the drupal instance is used by several websites. I've only been activating the base Captcha module and using the base Captcha (i.e. Math problem). I have translated a couple of strings to French because that's the language my users are speaking (which makes me think, I should finish the job and submit a po sometime).
Here is the log I get when adding the requested lines. Indeed, my server being in production, I don't have the devel module installed. ;)
Hope this helps!
Comment #21
soxofaan commentedThanks for that debug info, that really helps
It seems you used an other/older CAPTCHA version before. Is that correct? The session variable $_SESSION of your konqueror user is:
First: the key "captcha_correct" in this array is not used/generated by the CAPTCHA base module v5.x-3.x.
Second: the key "captcha" should point to a nested array and not a string ("5" here), this is the source of the message "Fatal error: Cannot use string offset as an array in captcha.module".
Another very weird thing is that $captcha_token is NULL, while $form['captcha']['captcha_token']['#value'] is "03ecfa6e23d5d93c145aa1c669329fc2"
The things you can do (one of them should be enough):
Comment #22
wundo commented#21,
If we force to clean cache in .install should fix it, don`t ?
Comment #23
soxofaan commentedat #22:
no, it has nothing to do with caching, it is a session thing.
And cleaning all the sessions in .install seems a bad idea because everybody will be logged out (including user 1)
Comment #24
Anonymous (not verified) commentedSoxofaan, thank you very much. I've cleared the cookies for my domain in Konqie and things worked as they should. So as this is not a Konqueror-specific problem, I've cleared my sessions tables to make sure no other user run into these problems, and reactivated Captchas with peace of mind. ;)
I think this bug can safely be closed now.
Comment #25
robloachExcellent! Be sure to get the 5.x-3.x-dev version too, it has a bunch of new updates.... Very very close to 3.0 final now.
Comment #26
gregglesThis seems to be an irregular bug. On a multisite of mine I had 3 sites using captcha. I upgraded 2 of them and it worked fine, but the third one exhibited this problem.
I agree that clearing sessions seems like an unnecessarily harsh solution, but I think something should be possible.
If the solution isn't in code then at least a warning message seems useful.
Also, changing title to more accurately reflect the error message to help people find this issue.
Comment #27
(not verified) commented