Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This is a really minor issue but displaying a load of error messages. For items that are actually 0 sometimes you can receive the following warning messages.
Notice: Undefined index: weight in physical_weight_convert() (line 578 of /modules/patch/physical/physical.module).
The reason being is that sometimes modules passes an empty array or an array that does not have a $weight['weight'] field.
Comment | File | Size | Author |
---|---|---|---|
#4 | 1887116-4.empty_weight_value.patch | 665 bytes | rszrama |
#2 | 18871160-physical_empty_weight_errors-2.patch | 466 bytes | ShaneOnABike |
#1 | 18871160-physical_empty_weight_errors.patch | 427 bytes | ShaneOnABike |
Comments
Comment #1
ShaneOnABike CreditAttribution: ShaneOnABike commentedHere's the patch for anyone that wants to implement it. I simply just returned an array with the correct values (i.e. an empty weight).
Comment #2
ShaneOnABike CreditAttribution: ShaneOnABike commentedSorry this one is better!
Comment #3
torgosPizzaThis looks good to me, assuming there are no unintended consequences, but I doubt there are many. We sell file downloads mainly, and I'd like to not have a bunch of Notice errors in our logs :)
Comment #4
rszrama CreditAttribution: rszrama at Centarro commentedI moved this up above the unit check to ensure the
empty($weight)
check runs before the unit type comparison. Added some comments as well.Comment #5
rszrama CreditAttribution: rszrama at Centarro commentedAaaand committed. Thanks!