Add support for PHP 8.x
-
Hi Tabby team đź‘‹,
After updating my site to PHP 8.1 (with WordPress 6.x and WooCommerce), I noticed the following warning in my error logs when placing an order:
PHP Warning: WC_Tabby::woocommerce_checkout_order_processed(): Argument #3 ($order) must be passed by reference, value given in /home/xxxx/public_html/wp-includes/class-wp-hook.php on line 324Root causeIn your plugin file:
/wp-content/plugins/tabby-checkout/includes/class-wc-tabby.phpThe function is currently defined as:
public function woocommerce_checkout_order_processed( $order_id, $posted_data, &$order ) { ... }WooCommerce passes the
$orderobject by value, not by reference.
PHP 8.x is stricter and throws a warning because of the&(pass-by-reference). Suggested fixSimply remove the reference
&in the function definition:public function woocommerce_checkout_order_processed( $order_id, $posted_data, $order ) { ... }This change makes the plugin compatible with PHP 8+ and WooCommerce’s current hook signature. ⚠️ Notes
- The warning doesn’t break checkout, but it clutters error logs.
- It’s best to patch this in the official release, so users don’t have to manually edit plugin files.
The topic ‘Add support for PHP 8.x’ is closed to new replies.