PHP Fatal error in WP-CLI
-
Hi Jeff,
it seems that since the refactoring in version
20180303
, GA Google Analytics plugin triggers fatal error in WP-CLI context:PHP Fatal error: Uncaught Error: Call to a member function default_options() on null in /var/www/grossglockner/wordpress/wp-content/plugins/ga-google-analytics/inc/plugin-core.php:171
I think the problem is that WP-CLI does not execute plugin files in global context, so the following line (450 in
ga-google-analytics.php
) does not actually set a global variable:$GA_Google_Analytics = new GA_Google_Analytics();
The error is gone as soon as I change the line to:
$GLOBALS['GA_Google_Analytics'] = $GA_Google_Analytics = new GA_Google_Analytics();
I don’t know if you use WP-CLI, but would be cool if you could check this problem out ?? To trigger the error, you can try the following WP-CLI command that just lists all installed plugins:
wp plugin list
Cheers,
?eslav
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘PHP Fatal error in WP-CLI’ is closed to new replies.