Problem/Motivation

In #3304886: [D7 PHP 8.2] Deprecated function: Creation of dynamic property in SelectQuery class $alterTags and $alterMetaData were made protected, but this is a breaking change, as before that change those properties were public.

D10 made them public

Steps to reproduce

See the related issues

Proposed resolution

Make them public

Remaining tasks

Review a patch

User interface changes

None

API changes

None

Data model changes

None (after the change)

Release notes snippet

TBD

CommentFileSizeAuthor
#2 3326249-2.patch549 bytestaran2l

Comments

Taran2L created an issue. See original summary.

taran2l’s picture

Status: Active » Needs review
StatusFileSize
new549 bytes
solideogloria’s picture

Status: Needs review » Reviewed & tested by the community

I already did this change manually yesterday, and it fixed the issue with Entity Reference for me on a production site.

poker10’s picture

So we would have a complete information about what is going on there.

D7 - both properties are currently protected

D9.4/9.5 - properties are not declared in Drupal\Core\Database\Query\Select class (EDIT: probably because the D9 is not compatible with PHP 8.2 yet).

D10.0/10.1 - only here both properties were added to the Drupal\Core\Database\Query\Select class (which I have missed, because was checking the latest D9 stable for backports) - https://git.drupalcode.org/project/drupal/-/blob/10.0.x/core/lib/Drupal/Core/Database/Query/Select.php#L122-130

mcdruid’s picture

Makes sense to align with D10 here.

We need to decide whether this change warrants a hotfix release. The next scheduled D7 release is not for 6 months.

Personally I think we should wait a bit longer to decide in case anything else should be included.

gbirch’s picture

Among the modules that rely on these properties being public are:

Commerce: see commerce_product_query_commerce_sku_or_title_match_alter()
EntityReference: see EntityReference_SelectionHandler_Generic::reAlterQuery().
Organic Groups: see og_query_membership_alter()
Organic Groups Register: see og_register_query_og_alter()

Since the protected status of these properties breaks important functionality, it seems important to get this patch in pronto, please!

gbirch’s picture

Priority: Normal » Major

See above, trying to bump the priority of this fix. Note that dynamic properties are (were) public in PHP 7, so the change to the core code is by definition a breaking change, and I don't think it was meant to be.

  • poker10 committed 3d6ca9c on 7.x
    Issue #3326249 by Taran2L: Make alterTags and alterMetadata public for...
poker10’s picture

Status: Reviewed & tested by the community » Fixed

Thanks everyone!

gbirch’s picture

Thank you!

joseph.olstad’s picture

Thanks! Wow ya looking forward to PHP 8.2!

Status: Fixed » Closed (fixed)

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