?
avatar mbabker
mbabker
1 Oct 2015

JFormRule, the base class for our form rule classes, documents the test() method as returning a boolean indicating whether a form field's value passes a rule. JFormRuleCaptcha returns an Exception instance if JCaptcha::checkAnswer() returns a value that would be evaluated as false. This form rule should be updated to follow the documented API.

avatar mbabker mbabker - open - 1 Oct 2015
avatar dgt41
dgt41 - comment - 1 Oct 2015

Is this good enough:

        // Test the value.
        if (!$captcha->checkAnswer($value))
        {
            return false;
        }

or we need to pass the error as well?

avatar mbabker
mbabker - comment - 1 Oct 2015

The documented API is that a boolean is returned, so that should be it. If we decide we want to change the API, that's another discussion (IMO it'd probably be more useful to throw Exceptions with a real error stack versus return boolean false here, but I don't know if that's something that can be done within the scope of the B/C rules).

avatar zero-24 zero-24 - change - 1 Oct 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 1 Oct 2015
Category Libraries
avatar mbabker mbabker - change - 30 Oct 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-10-30 18:12:32
Closed_By mbabker
avatar mbabker mbabker - close - 30 Oct 2015

Add a Comment

Login with GitHub to post a comment