Jetpack: Publicize: Fatal error on Settings page when locale file is invalid

Created on 22 Jun 2016  路  4Comments  路  Source: Automattic/jetpack

I'm seeing this error on wp-admin/options-general.php?page=sharing when Jetpack isn't connected to WordPress.com.

PHP Fatal error: require_once(): Failed opening required 'GLOTPRESS_LOCALES_PATH' in wp-content/plugins/jetpack/class.jetpack.php on line 4598

Note: PHP displays undefined constants without the PREFIX__ bit for some reason, but I double-checked that the constant being required is actually JETPACK__GLOTPRESS_LOCALES_PATH.

I'm using this as a temporary hotfix, which avoids the error:

if ( ! defined( 'JETPACK__GLOTPRESS_LOCALES_PATH' ) || ! file_exists( JETPACK__GLOTPRESS_LOCALES_PATH ) ) {
     return false;
}

Introduced in 1bcbe5763dfa8bd6e309e307ebe3487fcb8f2ed1 / #3717

Possibly related to #4162

Working on PR now.

Publicize [Type] Bug

Most helpful comment

The problem turned out to be that this site had defined JETPACK__GLOTPRESS_LOCALES_PATH in wp-config for an unrelated situation, and didn't take this possibility into account.

That explains why the error log was showing GLOTPRESS_LOCALES_PATH as the value of JETPACK__GLOTPRESS_LOCALES_PATH.

So, not Jetpack's fault at all.

All of the other modules check to make sure the file exists before including it, though, so I think it'd be good to do that here too, just to program defensively and to be consistent. I'll send a PR for that once I'm done fixing the wp-config issue on the site.

All 4 comments

Er, PHP does display FOO__BAR_FOO_BAR with the FOO__ prefix, so I'm not sure why JETPACK__GLOTPRESS_LOCALES_PATH is acting differently. I'll look into that as part of determining the best solution for the PR.

Looks like #4162 is unrelated. That was for Jetpack 4.0.3 and looks like it was a problem with their wp-config.php.

Correction: This happens when the site is connected, but the current user isn't.

The problem turned out to be that this site had defined JETPACK__GLOTPRESS_LOCALES_PATH in wp-config for an unrelated situation, and didn't take this possibility into account.

That explains why the error log was showing GLOTPRESS_LOCALES_PATH as the value of JETPACK__GLOTPRESS_LOCALES_PATH.

So, not Jetpack's fault at all.

All of the other modules check to make sure the file exists before including it, though, so I think it'd be good to do that here too, just to program defensively and to be consistent. I'll send a PR for that once I'm done fixing the wp-config issue on the site.

Was this page helpful?
0 / 5 - 0 ratings