ZF-5418: Improve Zend_Captcha usage example

Issue Type: Docs: Improvement Created: 2009-01-06T17:13:11.000+0000 Last Updated: 2010-05-27T01:38:04.000+0000 Status: Resolved Fix version(s): - 1.8.4 (23/Jun/09)

Reporter: Tim Fountain (tfountain) Assignee: Stanislav Malyshev (stas) Tags: - Zend_Captcha

Related issues: Attachments: - captcha-example.php


It is not very clear from the Zend_Captcha documentation exactly how to validate submitted CAPTCHAs when using Zend_Captcha as a standalone component (i.e. without Zend_Form).

The code example on:… shows the following:

<pre class="highlight">
// On subsequent request:
// Assume captcha setup as before, and $value is the submitted value:
if ($captcha->isValid($_POST['foo'], $_POST)) {
    // Validated!

Without delving into the source code users have no way of knowing that $_POST['foo'] should be a key/value array containing the keys id (id of the generated captcha), and input (the string the user entered into a form). The comment also references the variable $value, which is never set or used (I believe this is leftover from before the 1.7 changes made as a result of issue #ZF-3995)

It would be useful if this example was extended to be a working example that included a basic HTML form showing the markup required.


Posted by Tim Fountain (tfountain) on 2009-01-06T17:16:02.000+0000

Here's a working example based on the one currently in the docs.

Posted by Stanislav Malyshev (stas) on 2009-06-17T15:31:32.000+0000

thanks, I've changes the docs

Posted by Kevin (kevin.p) on 2010-05-27T01:38:02.000+0000

Hi! The issue still exists, the docu was never updated

The lines 12-14 say: echo "

"; echo $captcha->render($view); echo " ";

But they lack the most important info:

The full example for the form is then:

echo "

"; echo $captcha->render($view); echo ''; echo ''; echo " ";

Please update the documentation, it took me two hours yesterday to figure that out.

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.