Zend Framework

Zend_Captcha_Figlet validation problem

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.6.0
  • Fix Version/s: 1.7.0
  • Component/s: Zend_Captcha
  • Labels:
    None

Description

I have captcha form element:

$captcha = new Zend_Form_Element_Captcha('captcha', array(
    		'label' => "Please verify you're a human",
    		'captcha' => array(
        	'captcha' => 'Figlet',
        	'wordLen' => 6,
        	'timeout' => 300,
		),));

When not fill the edit box, and submit form, I get "Captcha value is wrong" message, ok.

But if I now resend this form by pressing F5, or Ctrl+R, form is validated successfully with empty captcha text box !!!!

Here a test form and controller:

CaptchaTestController.php
class CaptchaForm extends Zend_Form
{
	public function init()
	{
		$captcha = new Zend_Form_Element_Captcha('captcha', array(
    		'label' => "Please verify you're a human",
    		'captcha' => array(
        	'captcha' => 'Figlet',
        	'wordLen' => 6,
        	'timeout' => 300,
		),));
		$submit = new Zend_Form_Element_Submit('submit');
		$this->addElements(array($captcha, $submit));
	}
}

class CaptchaTestController extends Zend_Controller_Action
{
	function indexAction()
	{
		$form = new CaptchaForm(array(
			'action' => $this->view->url(array('controller' => 'captchatest')),
			'method' => 'post'));

		$this->view->form = $form;

		if($this->_request->getParam('submit'))
		{
			if ($form->isValid($this->_request->getParams()))
			{
				echo "valid form";
			}
			else
			{
				echo "invalid form";
			}
		}
	}
}

Activity

Hide
Tobias Gies added a comment -

upped to "Blocker" because this effectively renders Zend_Captcha_Figlet useless

Show
Tobias Gies added a comment - upped to "Blocker" because this effectively renders Zend_Captcha_Figlet useless
Hide
Ralph Schindler added a comment -

Assigning by ralph

Show
Ralph Schindler added a comment - Assigning by ralph
Hide
Thorsten Ruf added a comment -

This Problem occurs not only by using the Figlet Adapter. All Adapter shows the same behaviour.
Hopefully we have a fix as soon as possible because this error make the whole ZEND_CAPTCHA useless.

Show
Thorsten Ruf added a comment - This Problem occurs not only by using the Figlet Adapter. All Adapter shows the same behaviour. Hopefully we have a fix as soon as possible because this error make the whole ZEND_CAPTCHA useless.
Hide
Tobias Gies added a comment -

Thorsten is right, I can at least verify this for all Zend_Captcha_Word based implementations. I haven't tested Zend_Captcha_ReCaptcha yet.

Show
Tobias Gies added a comment - Thorsten is right, I can at least verify this for all Zend_Captcha_Word based implementations. I haven't tested Zend_Captcha_ReCaptcha yet.
Hide
Tobias Gies added a comment -

The problem was actually in Zend_Captcha_Word. Comparison was too weak, the error occured because '' == null. Used the !== operator instead.

Show
Tobias Gies added a comment - The problem was actually in Zend_Captcha_Word. Comparison was too weak, the error occured because '' == null. Used the !== operator instead.
Hide
Tobias Gies added a comment -

Added Unit test.

NOTE: BOTH MY PATCHES are relative to their respective parent directory, meaning the patch to Zend_Captcha_Word must be applied when in the /standard/trunk/library directory in SVN and the patch to Zend_Captcha_FigletTest must be applied in /standard/trunk/tests

Show
Tobias Gies added a comment - Added Unit test. NOTE: BOTH MY PATCHES are relative to their respective parent directory, meaning the patch to Zend_Captcha_Word must be applied when in the /standard/trunk/library directory in SVN and the patch to Zend_Captcha_FigletTest must be applied in /standard/trunk/tests
Hide
Tobias Gies added a comment -

Assigning to Matthew for inclusion

Show
Tobias Gies added a comment - Assigning to Matthew for inclusion
Hide
Alexander Veremyev added a comment -

Fixed.

Show
Alexander Veremyev added a comment - Fixed.
Hide
Wil Sinclair added a comment -

Changing issues in preparation for the 1.7.0 release.

Show
Wil Sinclair added a comment - Changing issues in preparation for the 1.7.0 release.

People

Vote (3)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: