- Issue created by @jantoine
- @jantoine opened merge request.
- Status changed to Needs work
over 1 year ago 5:18pm 28 October 2023 - πΈπ°Slovakia poker10
Thanks for reporting this.
The patch/MR fix is not working, because the variable
$areas
being checked in the if condition is defined only later. So this updated condition will always evaluate to FALSE:- if (!empty($field_item['country']) && !empty($field_item['administrative_area'])) { + if (!empty($field_item['country']) && !empty($field_item['administrative_area']) && !empty($areas[$field_item['administrative_area']])) { module_load_include('inc', 'addressfield', 'addressfield.administrative_areas'); $areas = addressfield_get_administrative_areas($field_item['country']);
-
poker10 β
committed 6c276aec on 7.x-1.x
Issue #3367463 by jantoine, poker10: PHP 8.0 incompatibility: Trying to...
-
poker10 β
committed 6c276aec on 7.x-1.x
- Status changed to Fixed
over 1 year ago 2:41pm 30 October 2023 - πΈπ°Slovakia poker10
As per documentation of
addressfield_get_administrative_areas()
, it can return aNULL
:/**
* Returns the predefined administrative areas.
*
* @param $country_code
* The country code for which administrative areas should be returned.
*
* @return
* An array of predefined administrative areas for the given country code, or
* NULL if not found.
*/
function addressfield_get_administrative_areas($country_code) {Fixed this by adding a
is_null
check on$areas
, see the commit. Thanks! Automatically closed - issue fixed for 2 weeks with no activity.