Amp-wp: Conflict with PWA plugin in WP Repo

Created on 15 Apr 2019  路  4Comments  路  Source: ampproject/amp-wp

Looks like there's a conflict with the Progressive Web Apps PWA Version 0.1.0 on WordPress.org.

Deactivating it or changing it to this one seems to help:
Version 0.2-alpha1-be8c1d7-20181112T064839Z

Fatal error: Uncaught Error: Undefined class constant 'QUERY_VAR' in /var/www/streetpatrol.com/sparefeber.dk/wp/wp-content/plugins/amp/includes/amp-helper-functions.php:260 Stack trace: #0 /var/www/streetpatrol.com/sparefeber.dk/wp/wp-content/plugins/amp/includes/class-amp-service-worker.php(243): is_amp_endpoint() #1 /var/www/streetpatrol.com/sparefeber.dk/wp/wp-includes/class-wp-hook.php(286): AMP_Service_Worker::add_install_hooks(Object(WP)) #2 /var/www/streetpatrol.com/sparefeber.dk/wp/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array) #3 /var/www/streetpatrol.com/sparefeber.dk/wp/wp-includes/plugin.php(531): WP_Hook->do_action(Array) #4 /var/www/streetpatrol.com/sparefeber.dk/wp/wp-includes/class-wp.php(750): do_action_ref_array('wp', Array) #5 /var/www/streetpatrol.com/sparefeber.dk/wp/wp-includes/functions.php(1105): WP->main('') #6 /var/www/streetpatrol.com/sparefeber.dk/wp/wp-blog-header.php(16): wp() #7 /var/www/streetpatrol.com/sparefeber.dk/index.php(17): require('/var/www/street...') #8 { in /var/www/streetpatrol.com/sparefeber.dk/wp/wp-content/plugins/amp/includes/amp-helper-functions.php on line 260

PWA

All 4 comments

Thank you for reporting this! Clearly we've only been testing with PWA 0.2-alpha and haven't been testing with the 1.0. Incidentally we're planning to release 0.2 of the PWA plugin today as well, but we need to avoid a conflict like this.

@GitaStreet And I take it that you are using 1.1-RC1 of the AMP plugin here?

The code in the AMP plugin is this:

https://github.com/ampproject/amp-wp/blob/e33ba104dfb9265e8799d7db639dad76361e96aa/includes/amp-helper-functions.php#L260

We need to check if WP_Service_Workers::QUERY_VAR exists before we use it.

@GitaStreet here's a PR with a fix including an amp.zip build for testing: #2134.

Was this page helpful?
0 / 5 - 0 ratings