PHP 8 Compatibility Issue - strlen of array
Apparently it's possible for the "$this->_text" of a Checkbox to be an array - at least an empty array.
This causes a fatal error from str here. https://github.com/civicrm/civicrm-packages/blob/61ff39518dfd54449158bfd44670063d84615015/HTML/QuickForm/checkbox.php#L138
To replicate:
Install the GDPR extension - this adds an additional "Terms & Conditions" tab to a contribution page. Configure the GDPR settings -> /civicrm/gdpr/settings select the option to enable for every contribution page.
It has a radio button that gives the option to "Enable terms and Conditions Acceptance" however as well as yes and no there is the option to not have this selected. Unselecting results in the above code being called with an empty array. This emits a warning in PHP7.4 but a fatal error in PHP 8.1
I'm unclear whether this is the GDPR extension behaving badly and should be left as is - or should we catch this?
This was found on a site upgrading to Drupal 10 - and therefore PHP 8.1 and manifested in a fatal error on contribution pages.
FZ Ref: 28529