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

Issue Type: Improvement Created: 2009-01-12T04:40:01.000+0000 Last Updated: 2012-11-20T21:28:34.000+0000 Status: Open Fix version(s): Reporter: Hiroshi Morotomi (hirop0164) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Captcha

  • NeedsPatch

Related issues: - ZF-3995



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.


No comments to display

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.