9

I get a 500 error with JHtmlBehavior::mootools not found. I know this has been removed in J3 but my problem is trying to find out where this issue is.

I suspect it is some sort of extension but I think I've updated them all. Obviously not. I see nothing in my php logs or developer tools console to indicate where the problem may be. I even grep for JHtmlBehavior and come up with nothing.

Any tips on how I can debug this?

9

Found the issue in my own custom component...ugh. I couldn't find the offending code because I was looking for JHtmlBehavior::mootools.

But the offending code was this:

JHTML::_('behavior.mootools');

Changing it to this fixes the problem:

JHtml::_('behavior.framework');
3

Although MooTools is deprecated in Joomla 3, it's still available (but might be removed in future versions).

You can load the framework by adding

JHtml::_('behavior.framework');

(or if you need both Core and More libraries):

JHtml::_('behavior.framework', true);

to your template's index.php file.

This will at least be a temporary fix, until you find the file/extension using Mootools code. Finding the culprit might be hard, but I suggest you start with your browsers Developer Tools (F12 in most browsers) and look for JavaScript errors, it might give you a hint.

  • Thanks but I tried both and still get the same error. Developer Tools (or Firebug) tell me nothing other than 500 internal server error. Any other ideas? – Tom Oct 13 '14 at 19:37
  • Are you sure you added the code correctly in JOOMLAROOT/templates/YOURTEMPLATE/index.php? You can add it directly after defined('_JEXEC') or die;. Check if MooTools has been loaded by typing window.MooTools in Firebug, it should return Object { version: "1.4.5", build: "74e34796f5f76640cdb98853004650aea1499d69" } or similar. – johanpw Oct 14 '14 at 0:47
  • Adding those JHtml:: calls won't stop the error, which is the result of an invalid call in the PHP on the site somewhere. – Craig Oct 14 '14 at 1:18
2

This is a PHP error resulting in Joomla throwing an error, so, not a Javascript error and not something to be fixed by adding more PHP. As you suspected you need to find the source of the errant PHP call.

The first thing to do is turn up your error reporting to "Development" and see that gives you any new information, if there is no new information that helps you track down the source of the error then it becomes the manual slice and dice approach.

Try swapping to a built-in template briefly and seeing if the problem goes away — if it does it's either the template or a module that is no longer called because it's assigned position doesn't exist in the default template you swapped to. If it's not the template you can track down the modules pretty quickly.

Finally, if that doesn't help, use the 50% method to narrow down quickly which group of components, modules or plugins are the source of the problem.

2

Here are some steps in order to find where the code is coming from:

  1. Well the best way is to download a full copy of the website, and do a OS system search inside its directory for JHTML::_('behavior.mootools');. Usually your computer will return a list with all the files that contain this specific string.

  2. If the first step is not possible, or you can't get any results for whatever reason, then you should start disabling extensions.

    a. First switch the template - to the core Joomla 3 protostar template. If the issue goes away most likely, it's your template that contains the deprecated code.

    b. Then you can start switching off modules and plugins.

    c. Finally, see if the issue appears to be only on specific pages of 3rd party components.

Find more information on how to load Javascript Frameworks on Joomla on Joomla Documentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.