? Success
Pull Request for # 6674

User tests: Successful: Unsuccessful:

avatar mepsteinj
mepsteinj
19 Jun 2015

This change prevents the plugin parameters are destroyed if the captcha plugin is loaded more than once on the same page.
#6674


Steps to reproduce the issue

Create two captcha fields in the same page through a form with type="captcha" (I use different "namespace" for each field)

Expected result

Two captcha in the same page.

Actual result

Error: reCAPTCHA plugin needs a site key to be set in its parameters. Please contact a site administrator.

System information (as much as possible)

Joomla 3.4.1

Additional comments

The fist time the captcha plugin is loaded, the _load function in the captcha library convert the plugin params from string to a Registry object, this is correct, but the second time the plugin is loaded, the library put the already converted params inside a new Registry object and the plugin params can't be used anymore.

File: libraries/cms/captcha/captcha.php
Line: 233

This issue can be fixed by checking if the plugin params is already a JRegistry object.

if (!($plugin->params instanceof JRegistry))
{
$params = new Registry($plugin->params);
$plugin->params = $params;
}

Please note. With the current version of Recaptcha (reCAPTCHA API version 2.0), you can have multiple recaptchas on one page, and this is the first step to achieve this feature.

avatar mepsteinj mepsteinj - open - 19 Jun 2015
avatar mepsteinj mepsteinj - change - 19 Jun 2015
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 19 Jun 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 19 Jun 2015
Category Libraries
avatar zero-24 zero-24 - change - 19 Jun 2015
The description was changed
Title
Update captcha.php
Prevents the plugin parameters are destroyed if the captcha plugin is loaded more than once
Rel_Number 0 6674
Relation Type Pull Request for
avatar zero-24 zero-24 - change - 19 Jun 2015
Title
Update captcha.php
Prevents the plugin parameters are destroyed if the captcha plugin is loaded more than once
avatar zero-24 zero-24 - change - 19 Jun 2015
Easy No Yes
avatar smz smz - test_item - 20 Jun 2015 - Tested successfully
avatar smz
smz - comment - 20 Jun 2015

Test OK.

Partial test:

  • OK by code review
  • No B/C issues with reCAPTCHA Version 1.0 in User self-registration
  • Untested with reCAPTCHA Version 2.0 (should not make any difference...)
  • Untested with 2 reCAPTCHAs in same page

@mepsteinj: If you can provide a test case we could more easily test the fixed functionality...

avatar 810
810 - comment - 4 Jul 2015

Yes, do you have a demo page, with the code, also with a example from the form

avatar zero-24 zero-24 - alter_testresult - 6 Nov 2015 - jeffchannell: Tested successfully
avatar zero-24
zero-24 - comment - 6 Nov 2015
avatar zero-24 zero-24 - test_item - 6 Nov 2015 - Tested successfully
avatar zero-24
zero-24 - comment - 6 Nov 2015

I have tested this item :white_check_mark: successfully on 2296e66

As @smz nothing gets broken by this Patch. Thanks.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7210.

avatar zero-24 zero-24 - alter_testresult - 6 Nov 2015 - smz: Tested successfully
avatar zero-24 zero-24 - change - 6 Nov 2015
Milestone Added:
Status Pending Ready to Commit
avatar zero-24
zero-24 - comment - 6 Nov 2015

RTC. Thanks


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7210.

avatar joomla-cms-bot joomla-cms-bot - change - 6 Nov 2015
Labels Added: ?
avatar wilsonge wilsonge - change - 11 Nov 2015
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2015-11-11 08:54:42
Closed_By wilsonge
avatar wilsonge wilsonge - close - 11 Nov 2015
avatar joomla-cms-bot joomla-cms-bot - close - 11 Nov 2015
avatar joomla-cms-bot joomla-cms-bot - change - 11 Nov 2015
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment