-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Describe the bug:
A critical fatal error occurs when running Google for WooCommerce v3.5.1 on PHP 8.3.25. The issue is caused by a type mismatch in the ImageUrlConstraint class. The $message property overrides the parent property from the Symfony Validator component but lacks the required string type declaration, which causes a fatal error in strict PHP 8.3 environments.
Steps to reproduce:
Set up a WordPress environment with PHP 8.3.25.
Install and activate Google for WooCommerce version 3.5.1.
Wait for the background synchronization process to run or trigger a product validation action.
Check the debug.log or server error logs.
Expected behavior:
The plugin should validate product image URLs without causing a fatal error.
Actual behavior:
The application crashes with a fatal error, preventing synchronization and filling the logs with critical errors.
Additional details:
Error Log:
text
CRITICAL Type of Automattic\WooCommerce\GoogleListingsAndAds\Validator\ImageUrlConstraint::$message must be string (as in class Symfony\Component\Validator\Constraints\Url)
CONTEXT: {"error":{"type":64,"file":"/wp-content/plugins/google-listings-and-ads/src/Validator/ImageUrlConstraint.php","line":15}}
System Info:
Plugin Version: 3.5.1
PHP Version: 8.3.25
Likely Cause: In PHP 8.3 (and newer Symfony versions), overridden properties must match the type definition of the parent class. The parent Symfony\Component\Validator\Constraints\Url defines public string $message, while ImageUrlConstraint likely defines it dynamically or without a type hint.
Regards. Boris