- Issue created by @nathankg
With the release of PHP 8.1, strlen() has depreciated accepting null values, therefore this error occurs:
Deprecated function: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\shopify\Entity\ShopifyProductVariant->getFormattedOptions() (line 131 of /app/site/modules/contrib/shopify/src/Entity/ShopifyProductVariant.php)
Any Drupal version.
Running a site using PHP8.1+
1. Install module
2. Configure and setup the module with shopify
3. View a product that has options (variants)
4. Select an option
5. An error will display or Check the Recent log messages
Update the getFormattedOptions function to not use array_filter strlen() callback for the purpose of stripping null values (but maintaining 0 values) replace with array diff filtering.
The issue was caused during this fix: https://www.drupal.org/project/shopify/issues/2867578 →
Active
Code