In PHP 8.0 Deprecation warnings arise in case of required parameter follows optional in function declaration:

Deprecated: Required parameter $options follows optional parameter $data in /modules/contrib/commerce/modules/cart/commerce_cart.module on line 1163

Deprecated: Required parameter $name follows optional parameter $data in /modules/contrib/commerce/modules/cart/commerce_cart.module on line 1163

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Natallia created an issue. See original summary.

Natallia’s picture

Natallia’s picture

Status: Active » Needs review
heni_deepak’s picture

I also facing the same issue.

apaderno’s picture

Title: Deprecated: Required parameter $options follows optional parameter $data in commerce_cart.module » Required parameter $options follows optional parameter $data in commerce_cart.module
Assigned: Natallia » Unassigned
Status: Needs review » Needs work
apaderno’s picture

Title: Required parameter $options follows optional parameter $data in commerce_cart.module » Required parameter $options follows optional parameter $data in commerce_cart.module on line 1163
Floris Vedder’s picture

Made an adjustment to the patch so the path is based on the root of the contrib module.

apaderno’s picture

Status: Needs work » Needs review
rszrama’s picture

Status: Needs review » Fixed

No clue why we ever even had an optional first parameter on this callback. Doesn't appear we did that for the other custom metadata callbacks. Patch is great, thanks!

  • rszrama committed bcf9cb6 on 7.x-1.x authored by Natallia
    Issue #3284128 by Natallia, Floris Vedder: Required parameter $options...
DamienMcKenna’s picture

Could one of the maintainers please tag a new release with this fix included? Thank you.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

bserem’s picture

A new release including this one is still pending

Neeraj420’s picture

after applying the patch I am getting the following error

Error: Call to undefined function commerce_product_reference_get_default_product() in commerce_cart_field_formatter_view() (line 2763 of /website/sites/all/modules/commerce/modules/cart/commerce_cart.module).

kindly help.
Thanks in advance