ZF-11522: Allow changing label on Zend_Captcha_Dumb

Issue Type: Patch Created: 2011-07-02T04:37:56.000+0000 Last Updated: 2012-05-05T00:39:18.000+0000 Status: Resolved Fix version(s): - 1.11.12 (22/Jun/12)

  • 1.12.0 (27/Aug/12)

Reporter: Evandro Abu Kamel (evandro.abukamel) Assignee: Adam Lundrigan (adamlundrigan) Tags: - Zend_Captcha

  • FixForZF1.12
  • state:need-feedback
  • zf-caretaker-adamlundrigan

Related issues: Attachments: - ZF-11522.patch



I'm creating a captcha field in a Zend_Form with Zend_Captcha_Dumb, but it has a static phrase that is present to the user. I sugest this because I try to create a class to extend Dumb, but I cannot use and validate it in a Zend_Form_Element, so, things became more complicated to a little change.

So, I think that is much useful to create a $_label attribute to the class, that can be or not setted by the programmer, and the class code will be like this...

<pre class="highlight">
/** @see Zend_Captcha_Word */
require_once 'Zend/Captcha/Word.php';

* Example dumb word-based captcha
* Note that only rendering is necessary for word-based captcha
* @category   Zend
* @package    Zend_Captcha
* @subpackage Adapter
* @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (<a href=""></a>)
* @license    <a href=""></a>     New BSD License
* @version    $Id: Dumb.php 23775 2011-03-01 17:25:24Z ralph $
class Zend_Captcha_Dumb extends Zend_Captcha_Word {
     * A label can be setted to the captcha phrase.
     * @attr string $_label
    protected $_label;
     * Set the label for the captcha.
     * @param string $label
    public function setLabel($label)
        $this->_label = $label;
    public function getLabel()
        return ($this->_label != "") ? $this->_label : "Please type this word backwards:";
     * Render the captcha.
     * @param  Zend_View_Interface $view
     * @param  mixed $element
     * @return string
    public function render(Zend_View_Interface $view = null, $element = null)
        return $this->getLabel() . ': <strong>'
            . strrev($this->getWord())
            . '</strong>';


Posted by Adam Lundrigan (adamlundrigan) on 2011-07-05T15:53:38.000+0000

You will need to sign and submit a CLA before we can apply your suggested improvement. See here:…

Posted by Adam Lundrigan (adamlundrigan) on 2011-11-15T03:11:09.000+0000

Simple fix suggested. Original poster unresponsive. Is it OK for me to re-implement suggestion without having OP sign a CLA?

Posted by Adam Lundrigan (adamlundrigan) on 2012-05-05T00:07:40.000+0000

Attached patch containing updated fix and a pair of unit tests. All Zend_Captcha tests still pass after change is applied.

Posted by Adam Lundrigan (adamlundrigan) on 2012-05-05T00:39:18.000+0000

Fixed in trunk (1.12.0): r24747 r24748 Merged to release-1.11 (1.11.12): r24749

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.