Babel errors in Manager Error Log

Hi all,

I’m trying to tame a particularly wild Manager Error Log on one of my sites.

Now, I don’t remember ever installing Babel on any of my sites - however I guess it must have been in here at some point :person_shrugging:

These errors are appearing in their hundreds:

[2022-06-27 20:58:08] (ERROR @ /home/xxyyzz/public_html/core/xpdo/xpdo.class.php : 1248) Problem getting service babel, instance of class Babel, from path /home/xxyyzz/public_html/core/components/babel/model/babel/
[2022-06-27 20:58:08] (ERROR @ /home/xxyyzz/public_html/core/xpdo/xpdo.class.php : 644) Could not load class: Babel from babel.

I’ve dumped the database and searched it for the phrase “babel” - StercSEO, PdoTools and SuperBoxSelect all make references to it but I don’t think any of these are what’s causing the errors to appear.

Can anyone tell me what tells MODX to try to load this Babel class?

Thanks as always.

From the error log, I think somewhere the code tries to get the service ‘babel’.

$modx->getService('babel', ...);

That’s usually done in a plugin (or in code that is called from a plugin).
Maybe also search all the code in the directory core/components for “babel” references and check that “babel” is not in the system setting extension_packages.

Thanks @halftrainedharry you got me on the right track :+1:

Searching the folder highlighted StercSEO [or SEOTab] and the following lines:


  364      {
  365          /* Include current resource. */
  366:         $babel = &$this->modx->getService(
  367:             'babel',
  368:             'Babel',
  369              $this->modx->getOption(
  370:                 'babel.core_path',
  371                  null,
  372:                 $this->modx->getOption('core_path') . 'components/babel/'
  373:             ) . 'model/babel/'
  374          );
  376:         /* Return if babel is not installed or the alternate links option is set to false or type is index or images. */
  377:         if (!$babel instanceof Babel ||
  378:             (int) $this->modx->getOption('stercseo.xmlsitemap.babel.add_alternate_links') !== 1 ||
  379              (isset($options['type']) && in_array($options['type'], array('index', 'images'), true))
  380          ) {

Looks like the check for whether Babel is installed happens after it tries to load the class - and it led me to discover that the errors occur when the sitemap.xml page is viewed.

I found a proposed fix on github and pasted the following before line 365:

 /* Return if babel model path does not exist */
        $babelModelPath = $this->modx->getOption('babel.core_path', null, $this->modx->getOption('core_path') . 'components/babel/').'model/babel/';
        if (!file_exists($babelModelPath)) {
            return '';

Problem solved.

Thanks as always.

Take a quick look at the extension_packages System Setting, which might also have a Babel reference that would waste server time.

thanks Bob - extension_packages was empty but I’ve been stung by that one before! :+1: