Afform - Fix display of search filter fields in PHP 8.1+
authorColeman Watts <coleman@civicrm.org>
Sun, 13 Nov 2022 01:32:02 +0000 (20:32 -0500)
committerColeman Watts <coleman@civicrm.org>
Sun, 13 Nov 2022 02:40:38 +0000 (21:40 -0500)
commit2e93a7c6ecc2433593ba64d99a32892392b55033
treee44b6b3701a6c5da27c2702d74c4abfb274ae0d5
parent828d8e9c08fe62ccac9d030c650b2a3cf2bea545
Afform - Fix display of search filter fields in PHP 8.1+

In PHP 8.1 Afform search fields stopped working. This is due to an encoding change which broke the parser.

According to https://www.php.net/manual/en/function.htmlspecialchars.php#refsect1-function.htmlspecialchars-changelog
PHP 8.1 changed the default mode for `htmlspecialchars`, the impact of which is to escape straight quotes
instead of leaving them alone.

This ensures the function works the same on all PHP versions by explicitly setting the mode.
ext/afform/core/Civi/Afform/AfformMetadataInjector.php
ext/search_kit/Civi/Search/AfformSearchMetadataInjector.php