Issues

ZF-5527: CLONE -[CAPTCHA] isValid function doesn't make sense

Description

note: I added it as Unknown since Captcha isnt in the component list yet.

The isValid function in Zend_Captcha_Word doesn't make any sense at all. I just downloaded the RC2 version of 1.6 and I noticed the Captcha functionality and I really want to test is as it looks very usable. Generating the image with Zend_Captcha_Image works great but validating it is very unclear:

The manual says it should go like this:

// On subsequent request: // Assume captcha setup as before, and $value is the submitted value: if ($captcha->isValid($value)) { // Validated! }

So it makes sense that $value is the value posted by the user but the function isValid accepts 2 params: $value and $context. The first check in the function checks for the existence of $context[$name]['input'] but that wont be there if you supply only the value (just like in the example). According to the function $content may be left out (null) but that doesnt seem correct at all. A few lines behind the first check (which uses $context instead of $value) $value is overwritten by a key in $context[$name]. So, you can supply $value to the function but it will always get overwritten by the value of $context[$name]['input'].

So to sum it all up : - the docs are wrong - $value isnt used in the function although the docs use it as the only parameter - there is no documentation on what $context exactly should be

edit: i dont know how i can comment myself so ill edit it: its not only a documentation thing here, the $value var is never used in the function so the function should be changed so it will be used or the var must be left out at all.

edit: I don't know how I reopen the issue. so I cloned. This issue is not solved. The function is still useless because name of value is fixed and there is no way for those who can't use name "input" for captcha value.

Comments

No comments to display