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

  1. Install the latest versions of FacetAPI and its dependencies on a Drupal 7 site running on PHP 8.2. Panopoly distro works for this.
  2. If not using Panopoly, configure a Search API results page and add some facets.
  3. Create some content and perform a Search API search using keywords in the content.
  4. 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.

Comments

cboyden created an issue. See original summary.

cboyden’s picture

Version: 7.x-2.x-dev » 7.x-1.x-dev
Assigned: cboyden » Unassigned
StatusFileSize
new468 bytes

Patch is attached.

cboyden’s picture

Status: Active » Needs review

joseph.olstad’s picture

Status: Needs review » Fixed
joseph.olstad’s picture

StatusFileSize
new1.02 KB
joseph.olstad’s picture

Status: Fixed » Needs review
joseph.olstad’s picture

Couple missed PHP 8.2 fixes.

Checking.

joseph.olstad’s picture

StatusFileSize
new1.03 KB

try again, this time following advice here:

https://php.watch/versions/8.2/partially-supported-callable-deprecation

Not sure if this will work at all.

  • joseph.olstad committed 0555bd14 on 7.x-1.x
    Issue #3401917 by joseph.olstad, cboyden: Dynamic properties are...
joseph.olstad’s picture

Status: Needs review » Fixed

It worked!

joseph.olstad’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.