?
avatar thekrotek
thekrotek
28 Feb 2015

Steps to reproduce the issue

Use recaptcha plugin and do not define $code for 'onCheckAnswer' event.

Expected result

Successfully submitted form.

Actual result

Throws an error:

Warning: Missing argument 1 for PlgCaptchaRecaptcha::onCheckAnswer() in /mysite/plugins/captcha/recaptcha/recaptcha.php on line 114

System information (as much as possible)

Joomla 3.4, custom form.

Additional comments

Fix is very simple: remove $code variable from onCheckAnswer() function definition. It's obsolete and never used.

avatar thekrotek thekrotek - open - 28 Feb 2015
avatar brianteeman
brianteeman - comment - 28 Feb 2015

As you have identified an issue and a solution please can you submit a Pull Request so that it can be tested and merged.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6228.
avatar mbabker
mbabker - comment - 28 Feb 2015

How are you triggering the event? In JCaptcha::checkAnswer() the code variable is defined before calling the plugin event.

Yes, the variable is not used in this plugin, however it appears that the base API expects to use it (perhaps with other captcha providers).

avatar thekrotek
thekrotek - comment - 28 Feb 2015

I'm using the standard $dispatcher->trigger('onCheckAnswer', '') line. I understand the backwards compatibility with other captcha plugins, but at least $code variable can be optional:

public function checkAnswer($code = '')

That was my initial point.

avatar brianteeman brianteeman - change - 28 Feb 2015
Labels Added: ?
avatar PhilETaylor
PhilETaylor - comment - 1 Mar 2015

This code is cleaned up in my other PR https://github.com/joomla/joomla-cms/pull/6235/files#L114

avatar zero-24 zero-24 - change - 1 Mar 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-03-01 20:20:33
Closed_By zero-24
avatar joomla-cms-bot joomla-cms-bot - change - 1 Mar 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-03-01 20:20:33
avatar joomla-cms-bot joomla-cms-bot - close - 1 Mar 2015
avatar joomla-cms-bot joomla-cms-bot - close - 1 Mar 2015
avatar joomla-cms-bot
joomla-cms-bot - comment - 1 Mar 2015

Set to "closed" on behalf of @zero-24 by The JTracker Application at issues.joomla.org/joomla-cms/6228

avatar zero-24
zero-24 - comment - 1 Mar 2015

Closing as we have a PR by @PhilETaylor #6235


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6228.
avatar PhilETaylor
PhilETaylor - comment - 2 Mar 2015

The PR is now clean and ready for testing/merging

Add a Comment

Login with GitHub to post a comment