Closed marianotalbot closed 1 year ago
Same issue here, are you using Mootools by any chance on your site?
Seems to be related to this
Although with Moo 1.6, the issue persists
Array.from deprecated, now called Array.convert: Following the conclusion of the ES6 specs we know now that Array.from will have a different implementation than the one MooTools uses.
Reproduced here in a very basic HTML site using google hosted libraries.
Works http://www.djb31st.co.uk/captcha_test.php
Include MooTools 1.6.0 and it breaks http://www.djb31st.co.uk/captcha_test.php?no_moo=1
Is there any fix for this? Having the same issue
I'm currently awaiting to hear back from Mootools or Google ReCaptcha.
The fix needs to be applied at their end, the only temp fix is to remove MooTools
Yes. It is a problem with MooTools. It worked fine since 2017/2018 and now it breaks.
This currently affects all joomla websites using reCaptcha. Has any of the maintainers investigated this yet?
I have same issue on Joomla 2.5.3 + reCaptcha v2, and solved by update mootools manually.
Update /media/system/js/mootools-core.js from https://mootools.net/core
Update /media/system/js/mootools-more.js from https://mootools.net/more
Same problem here. I'm glad updating mootools on your Joomla 2.5 website worked!
I wish it was that easy on a large Joomla 1.5 website that I have to maintain ;(
I have tried updating mootools core
and more
tools to the latest versions but the problem still occurs.
I have same issue on Joomla 2.5.3 + reCaptcha v2, and solved by update mootools manually.
Update /media/system/js/mootools-core.js from https://mootools.net/core
Update /media/system/js/mootools-more.js from https://mootools.net/more
This solve my problem, Thank you
The reason pulling the core from mootools directly fixes it as it doesn't have the compatibility code that lets older functions that have been removed worked.
Be careful just updating to the latest as if you are on an old Joomla it will potentially break JavaScript in some areas of the site
The reason pulling the core from mootools directly fixes it as it doesn't have the compatibility code that lets older functions that have been removed worked.
Be careful just updating to the latest as if you are on an old Joomla it will potentially break JavaScript in some areas of the site
I'm wondering if anyone has isolated where in the compatibility layer the conflict is occurring. For my case, I do have legacy code to maintain and would prefer to remove the offending item(s) from MooTools manually than do a massive update.
I've not had chance to look yet and was kinda hoping that someone at Google might be investigating. It appears that it might be in our hands though.
There was a warning of compatibility with google maps as well, which was down to mootools overriding
Array.from
However i manually renamed that to Array.convert including all references which resolved the maps error but did not resolve the captcha error.
The error is triggered in the "bind" function of mootools.
I guess renaming that might work, as long as no mootools code elsewhere uses it. I'll give it a test
Looks that bind has been in javascript spec for a while, the new re-captcha uses this and mootools overwrites it with a non standard method.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_objects/Function/bind
Using a local version of mootools with the method renamed to moobind works
http://www.djb31st.co.uk/captcha_test.php?local_moo=1
Here is a working 1.6, will upload older versions shortly mootools_1_6.txt
However if you are using any other mootools plugins (Which you likely are) this will break them :-(
We really need Google to resolve this at their end
Hi all,
Thank you for the notes on reproducing this. To more or less echo what's already been said upthread: this behavior is caused by MooTools using a non-spec implementation of bind.
As @DJB31st mentioned above, this can be fixed by renaming the MooTools' bind function & all usage so that it doesn't conflict with the standards version of bind (which is what reCAPTCHA uses).
I hope this helps. I realize this probably isn't the answer you were hoping for - but unfortunately this type of conflict is difficult for us to fix from our end.
Can anybody give some more detailed instructions for those of us who are not experts on mootools as to exactly how to go about doing the fix above suggested by khempenius : " rename the MooTools' bind function & all usage so that it doesn't conflict with the standards version of bind (which is what reCAPTCHA uses)".
The issue is with the MT 1.2 compatibility layer, which if you are using MT 1.3 you probably have.
This can be worked around in a way that shouldn't affect MT stuff if you don't mind feeling dirty doing it, I have only tested this in Chrome (Chromium)...
Locate the 1.2compat section of your moootools core javascript file make the change indicate below...
//<1.2compat>
/* ADD THIS LINE --> */ Function.prototype._nativebind = Function.prototype.bind;
delete Function.prototype.bind;
and about 20 lines below there make this change...
bind: function(bind, args){
/* ADD THIS LINE --> */ if( new Error().stack.match(/recaptcha/) ) return this._nativebind(bind, args);
this special-cases the compatibility version of bind
so that if it is being used by recaptcha it will redelegate to the native bind
obviously this might be brittle, might have performance penalty, and eventually other things you absorb into your site might also need to be special cased, but as a quick fix, it's workable (in Chrome/Chromium, not tested others).
If you don't want to edit the files directly, you can just load this fix javascript after loading your mootools core/more...
https://gist.github.com/sleemanj/f076ed2c0b887ab08074b55dad2fd636#file-mt-recaptcha-fix-js
(Edit: updated since original posting, see comment few below, this link is to the correct version though)
should do the job (again, tested only in Chrome/Chromium)
I don't think the Core in my build of MooTools 1.4.5 has compat layer because this fix isn't working. Is there a fix with that in mind?
I have same issue on Joomla 2.5.3 + reCaptcha v2, and solved by update mootools manually.
Update /media/system/js/mootools-core.js from https://mootools.net/core
Update /media/system/js/mootools-more.js from https://mootools.net/more
Hi, how exactly did you upgrade? When I am using 1.6 (core + more) I am getting the same result.
I was able to fix it for joomla 2.5 by using mootools 1.6 core with 1.2 compat (replacing with everything in mootools-core.js) and the full more package. Then in the resulting "mootool-more.js" I appended @sleemanj 's fix.
Looks ok so far.
If using the gist file I posted above there were a couple of errors. The name of the file containing the fix shouldn't include the name recaptcha (facepalm!) and the fall through didn't actually pass the arguments or call the function or do anything remotely like it should have (double facepalm!)
https://gist.github.com/sleemanj/f076ed2c0b887ab08074b55dad2fd636
Hi, how exactly did you upgrade? When I am using 1.6 (core + more) I am getting the same result.
@crosstec I just download, rename, replace these 2 files (mootools-core.js, mootools-more.js).
Many thanks sleemanj for that fix.
I was just about to start re-writing everything with Jquery so thats took the pressure of an immediate fix!
I did have a quick look at implementing a similar fix for the overriding of array.from as that conflicts with maps API v3.
Although settled on my renaming suggestion above @sleemanj
Adding mootools-core.js, mootools-more.js fixed recaptcha problem, but after that all admin elements crashed)
P.S. Joomla 2.5.28
Just wanted to add that for anyone using Joomla versions 1.5 or 2.5 with K2 v2.10.x, we've already patched K2's reCaptcha v2 implementation for these Joomla versions in K2 v2.10.4 (dev) which can be downloaded from https://getk2.org/downloads/?f=K2_Development_Release.zip - thank you @sleemanj for the fix 👍
For anyone using Gantry v4 on Wordpress, I made a simple Wordpress plugin using sleemanj's patch file. This patch fixed the error perfectly on a Wordpress site running a theme Rocketheme, Gantry v4, and Gravityforms.
You can check it out here: https://github.com/cuppajoey/mootools-recaptcha-fix Thank you very much @sleemanj your patch worked like a charm!
Closing old issues that are not related to the PHP client code.
Recaptcha is not loading.
Console:
Uncaught TypeError: Cannot read property 'offsetWidth' of undefined at uC (recaptchaes.js:246) at mootools-core-1.3.1.js:84 at AW (recaptchaes.js:7) at sK (recaptchaes.js:304) at ZP (recaptchaes.js:199) at nn.Ra (recaptchaes.js:159) at new nn (recaptchaes.js:611) at mv (recaptchaes.js:61) at recaptchaes.js:297 at Array.forEach ()