Problem/Motivation
In PHP 8.2, dynamic properties are deprecated. At least one class in FacetAPI does not declare all the properties that can be created on its instances.
Steps to reproduce
- Install the latest versions of FacetAPI and its dependencies on a Drupal 7 site running on PHP 8.2. Panopoly distro works for this.
- If not using Panopoly, configure a Search API results page and add some facets.
- Create some content and perform a Search API search using keywords in the content.
- Note this message in the logs:
Deprecated function: Creation of dynamic property FacetapiWidgetLinks::$sorts is deprecated in FacetapiWidget->sortFacet() (line 291 of /facetapi/plugins/facetapi/widget.inc).
Proposed resolution
Add the annotation to allow dynamic properties to the class. Another solution would be to declare all the properties in the class.
Remaining tasks
Patch and test.
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 3401917-08.patch | 1.03 KB | joseph.olstad |
| #6 | 3401917-06.patch | 1.02 KB | joseph.olstad |
| #2 | facetapi-dynamic-properties-php82-3401917-2.patch | 468 bytes | cboyden |
Comments
Comment #2
cboyden commentedPatch is attached.
Comment #3
cboyden commentedComment #5
joseph.olstadComment #6
joseph.olstadComment #7
joseph.olstadComment #8
joseph.olstadCouple missed PHP 8.2 fixes.
Checking.
Comment #9
joseph.olstadtry again, this time following advice here:
https://php.watch/versions/8.2/partially-supported-callable-deprecation
Not sure if this will work at all.
Comment #11
joseph.olstadIt worked!
Comment #12
joseph.olstadNew release
https://www.drupal.org/project/facetapi/releases/7.x-1.10