In preparation for PHP 7.3, this commit makes the regular expressions used in Emogrifier compatible with PCRE2. It was necessary to escape hyphens used in a few regular expressions. Since the changes were simple and I'm not familiar enough with Emogrifier, I opted to backport the changes that they made in preparation for PHP 7.3 (https://github.com/MyIntervals/emogrifier/pull/588 and https://github.com/MyIntervals/emogrifier/issues/587) instead of updating the library to the yet to be released version 2.1.0.
This change removes the following warning when running WC unit tests using PHP 7.3:
PHP Warning: preg_replace(): Compilation failed: invalid range in character class at offset 39 in includes/libraries/class-emogrifier.php on line 1504
For more information about the PCRE2 change in PHP 7.3 see the section "PCRE to PCRE2 migration" in the link https://ayesh.me/Upgrade-PHP-7.3
This commit changes the regular expression used to determine the WP_TESTS_TAG variable to ignore WP beta releases otherwise install_test_suite() will fail to download the test suite. This is part of workaround to run WooCommerce unit tests using PHP 7.3 and WP 5.0 beta-5.
To make it easier to test WC running the upcoming PHP 7.3, this commit changes the PHP 7.3 Travis build to run unit tests using WP 5.0-beta5. This way we won't display WP core warnings related to PHP 7.3 that were already fixed in the upcoming WP version and will be able to see only WC related warnings.
My initial plan was to use WP nightly but that didn't work as nightly is still build from trunk and WP 5.0 development is being done on another branch (https://make.wordpress.org/core/2018/10/05/wordpress-5-0-commit-management/).
When sending a customer their invoice on a non-pending order, I get this
error in the logs:
PHP Fatal error: Uncaught Error: Using $this when not in object context in
wp-content/plugins/woocommerce/templates/emails/plain/customer-invoice.php:37
Stack trace:
#0 wp-content/plugins/woocommerce/includes/wc-core-functions.php(208): include()
#1 wp-content/plugins/woocommerce/includes/wc-core-functions.php(228): wc_get_template('emails/plain/cu...', Array, '', '')
#2 wp-content/plugins/woocommerce/includes/emails/class-wc-email-customer-invoice.php(165): wc_get_template_html('emails/plain/cu...', Array)
#3 wp-content/plugins/woocommerce/includes/emails/class-wc-email.php(502): WC_Email_Customer_Invoice->get_content_plain()
#4 wp-content/plugins/woocommerce/includes/emails/class-wc-email-customer-invoice.php(130): WC_Email->get_content()
#5 wp-content/plugins/woocommerce/includes/class-wc-emails.php(338): WC_Email_Customer_Invoice->trigger(288402, Object(WC_Order))
#6 wp-content/plugins/woocommerce/templates/emails/plain/customer-invoice.php on line 37
referer: wp-admin/post.php?post=nnnnnn&action=edit
Change the "$this->object" reference to "$order" instead.
- Now wp-coding-standards/wpcs and wimg/php-compatibility are dependencies of WooCommerce Sniffs.
- Updated wp-coding-standards/wpcs to 1.1.
- Updated wimg/php-compatibility to 9.0.