Describe your bug or feature request.
On upgrade to PHP 8.1 I get the following errors in the log:
Deprecated function: unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in CommerceProductEntityController->attachLoad() (line 130 of C:\wamp64\xxx\sites\all\modules\contrib\commerce\modules\product\includes\commerce_product.controller.inc).
Deprecated function: unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in CommerceCustomerProfileEntityController->attachLoad() (line 121 of C:\wamp64\xxx\sites\all\modules\contrib\commerce\modules\customer\includes\commerce_customer_profile.controller.inc).
Deprecated function: unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in CommercePaymentTransactionEntityController->attachLoad() (line 137 of C:\wamp64\xxx\sites\all\modules\contrib\commerce\modules\payment\includes\commerce_payment_transaction.controller.inc).
If a bug, provide steps to reproduce it from a clean install.
PHP 8.1.0
Drupal core 7.92
Commerce Core 7.x-1.17
I'm not sure this is the best approach, but based on patches I've seen for similar errors in other modules, I did this for each of the three affected files:
- $profile->data = unserialize($profile->data);
+ $profile->data = unserialize($profile->data ?? '');
Everything still seems to work now and the errors are gone, but I have a sneaking suspicion that the real fix is more complicated that this.
Patch coming as soon as I get an issue number.