On PHP 8.1 and commerce version 2.29 (and 2.30)
when trying to either load variations by entity reference OR when trying to load them with load multiple entity types without defined ids as an parameter.
->getStorage('commerce_product_variation')->loadMultiple()
The following error appears
Deprecated function: unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in Drupal\Core\Entity\Sql\SqlContentEntityStorage->loadFromDedicatedTables() (line 1257 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Drupal\Core\Entity\Sql\SqlContentEntityStorage->loadFromDedicatedTables(Array, ) (Line: 502)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->mapFromStorageRecords(Array) (Line: 427)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->getFromStorage(Array) (Line: 393)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->doLoadMultiple(Array) (Line: 346)
Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array) (Line: 46)
Drupal\Core\Field\EntityReferenceFieldItemList->referencedEntities() (Line: 17)
Drupal\commerce\Entity\CommerceContentEntityBase->getTranslatedReferencedEntities('variations') (Line: 175)
Drupal\commerce_product\Entity\Product->getVariations() (Line: 240)
Drupal\commerce_product\Entity\Product->getDefaultVariation() (Line: 92)
Drupal\commerce_product\ProductViewBuilder->alterBuild(Array, Object, Object, 'teaser') (Line: 292)
Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array) (Line: 239)
Drupal\Core\Entity\EntityViewBuilder->build(Array)
call_user_func_array(Array, Array) (Line: 101)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 772)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 363)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array) (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 52)
__TwigTemplate_ee9abbf1b2c5ec69a51e0f65a0288929->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 55)
On first load it shows it, on the second (cached) load it does not.