Closed (fixed)
Project:
CAPTCHA
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
11 Aug 2009 at 01:38 UTC
Updated:
31 Mar 2010 at 21:40 UTC
Jump to comment: Most recent file
finally submitting cumulated fixes..
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 545526_undefined_indices_02.patch | 2.49 KB | soxofaan |
| #9 | 545526_undefined_indices_01.patch | 2.57 KB | soxofaan |
| #6 | captcha-fix-stupid-bug-rofl.patch | 1.5 KB | eMPee584 |
| captcha-fix-undefined-indices.patch | 1.55 KB | eMPee584 |
Comments
Comment #1
soxofaan commentedGood catches, thanks.
Good point, but I would do this like
to avoid writing to $_SESSION when not needed.
this looks strange. with what challenge module did you get an undefined index warning here?
Anyway, if the solution is not set, I, think its a bit dangerous to leave it empty, as if the empty answer is the right one. I'll have to look into this.
On which form did you get an undefined index warning here?
Comment #2
eMPee584 commentedooops totally forgot this issue when posting patch at #349218: Sometimes first character of image CAPTCHA is invisible: weird bug in PHP's bounding box calculation.. well regarding 1, yes sure better although i'm not sure about the cast.. 2) well it happens, form hickups with spam bots and everything... 3) same thing.. might be from aborted page calls or what not?! Just had couple of those in my watchdog table and thought, better make this spam bullet proof...
Comment #3
soxofaan commentedreproduced problem 1) and committed fix in http://drupal.org/cvs?commit=256840, thanks
concerning 2) and 3) I really would like more info on how to reproduce. Your explanation in #2 is a bit fuzzy :) I immediately don't see how "hickups" and aborted page calls could cause "undefined indices" messages that would not show up on normal page calls in those cases.
For example:
for 2) which CAPTCHA type are you using?
for 3) on which form_ids do you have a CAPTCHA?
Comment #4
eMPee584 commentedwell using image captchas, pretty much for all anon form submissions..
thing is, stuff like this ain't always reproducible. i catch those errors from my watchdog, look what causes them, fix/retry and during that usually find some more ;/
so, if you really want to know the exact circumstances of when these occured, maybe i'll put in some debug code. But not right now *g
Comment #5
soxofaan commented3) is related to #534168: Submit with "return"/"enter" key in IE7 leads to failing CAPTCHA and it will be solved over there
The remaining thing is 2):
I'd like instruction on how to reproduce this because if
$captcha['solution']is not set, something is seriously wrong. Ignoring this by just blindly setting the solution to an empty string is a bad idea IMHO.Comment #6
eMPee584 commentedWow now after wasting quite some time on doing that (grokking 3).. how trivial is this one. Think about it ;D
Comment #7
soxofaan commentedCan you describe what bug the patch is trying to fix?
Why this change? According to the PHP documentation (http://www.php.net/manual/en/function.empty.php, http://php.net/manual/en/language.types.boolean.php), there is not much difference in this context ($captcha should be an array).
Why this move? What is the bug here?
Comment #8
eMPee584 commented> Can you describe what bug the patch is trying to fix?number 3 was still unanswered, right?
Only cosmetic. Of course it works to apply an implicit boolean comparison on an array. But it is ugly, imho-
This is still about point 3)... Please, have a look at that function again. Try to regrok it (hint: if statement can evaluate to false too - for good reason..) and you'll lol too ;-p
Comment #9
soxofaan commentedthe
$element['#captcha_info']stuff is outside the if body, because that information could also be used by other "consumers" than the validate and prerender handlers. The documentation does not mention that, so I understand the misunderstanding :). Apart from that,'solution' => $captcha['solution']is indeed undefined when the if condition evaluates to false, so can cause "undefined indices" problems.Anyway, I worked a bit on your patch
Comment #10
soxofaan commentedreroll
(and hopefully the testbot will pick this up)
Comment #11
soxofaan commentedhttp://drupal.org/cvs?commit=342818
http://drupal.org/cvs?commit=342832