Thread Starter
IDWD
(@guardian88)
Here is our latest php error from our log
[13-Dec-2018 12:48:44 UTC] PHP Fatal error: Uncaught Error: Call to undefined method Sabberworm\CSS\CSSList\Document::splice() in /home/petroleucarlisle/public_html/wp-content/plugins/amp/includes/sanitizers/class-amp-style-sanitizer.php:1713
Stack trace:
#0 /home/petroleucarlisle/public_html/wp-content/plugins/amp/includes/sanitizers/class-amp-style-sanitizer.php(1451): AMP_Style_Sanitizer->transform_important_qualifiers(Object(Sabberworm\CSS\RuleSet\DeclarationBlock), Object(Sabberworm\CSS\CSSList\Document))
#1 /home/petroleucarlisle/public_html/wp-content/plugins/amp/includes/sanitizers/class-amp-style-sanitizer.php(1252): AMP_Style_Sanitizer->process_css_declaration_block(Object(Sabberworm\CSS\RuleSet\DeclarationBlock), Object(Sabberworm\CSS\CSSList\Document), Array)
#2 /home/petroleucarlisle/public_html/wp-content/plugins/amp/includes/sanitizers/class-amp-style-sanitizer.php(990): AMP_Style_Sanitizer->process_css_list(Object(Sabberworm\CSS\CSSList\Document), Array)
#3 /home/petroleucarlisle/public_html/wp-content/plugins/amp/includes/sanitizers/cl in /home/petroleucarlisle/public_html/wp-content/plugins/amp/includes/sanitizers/class-amp-style-sanitizer.php on line 1713
Same issue here, all our AMP Pages on all sites are broken.
@guardian88 @mexl Thanks for reporting. It seems you may have CSS that we haven’t encountered before, and it is causing this exception. I’ll try to replicate the issue and give you a patch to test.
@guardian88 @mexl Did you install the plugin via WordPress.org or via GitHub?
The error says that Sabberworm\CSS\CSSList\Document::splice() is not defined.
However, the Sabberworm\CSS\CSSList\Document class extends Sabberworm\CSS\CSSList\CSSBlockList: https://plugins.trac.wordpress.org/browser/amp/tags/1.0.1/vendor/sabberworm/php-css-parser/lib/Sabberworm/CSS/CSSList/Document.php#L8
And Sabberworm\CSS\CSSList\CSSBlockList extends Sabberworm\CSS\CSSList\CSSList: https://plugins.trac.wordpress.org/browser/amp/tags/1.0.1/vendor/sabberworm/php-css-parser/lib/Sabberworm/CSS/CSSList/CSSBlockList.php#L16
And Sabberworm\CSS\CSSList\CSSList defines the splice method: https://plugins.trac.wordpress.org/browser/amp/tags/1.0.1/vendor/sabberworm/php-css-parser/lib/Sabberworm/CSS/CSSList/CSSList.php#L61
So I don’t know why the plugin would error for this not being defined on your installs.
Thread Starter
IDWD
(@guardian88)
We installed the plugin via wordpress. IF you need admin access to troubleshoot let us know. We have a test site setup
OK, please ping me on WordPress Slack with the login details.
@mexl Do you have the Mail Poet plugin installed per chance?
The issue appears to be that another plugin has a conflicting version of PHP-CSS-Parser, one which does not have the splice method.
Here is a pull request and build of the plugin to try which includes detection for PHP-CSS-Parser library conflicts: https://github.com/ampproject/amp-wp/pull/1743#issuecomment-447174483
Please test.
Thread Starter
IDWD
(@guardian88)
The issue is PHP-CSS-Parser when combined with MailPoet (in our environment). PR fixed our issue and performs stable in testing. Thanks for the help @westonruter
@westonruter Thank you, yes, all our sites use Mailpoet.
All the best!