Problem/Motivation
A lot of PHP 8.2 tests currently fail like this:
Exception: Deprecated function: Creation of dynamic property Drupal\Core\Database\Query\Condition::$sqlQuery is deprecated
Drupal\Core\Entity\Query\Sql\Condition->compile()() (Line: 44)
Steps to reproduce
What's happening is that this is a trick to pass the query object to the compile method of its child condition (entity query condition object, not SQL condition).
Proposed resolution
There is already a better pattern used in the same place. Set a documented, protected property of itself on the child object, which works because it's the same class.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | interdiff_2-10.txt | 1.01 KB | ravi.shankar |
| #10 | 3311562-10.patch | 3.38 KB | ravi.shankar |
| #2 | entity-query-condition-sqlQuery-3311562-2.patch | 3.41 KB | berdir |
Comments
Comment #2
berdirComment #3
Anonymous (not verified) commentedI have checked with drupal 10.1.x and the patch applies successfully.
Comment #4
andypostIt may need a test but PHP 8.2 already used to catch it via existing coverage
See #3295821-114: Ignore: patch testing issue for PHP 8.2 attributes
Comment #6
catchGiven existing test coverage is catching the PHP 8.2 issue and tests are passing, I don't think we need to add explicit new test coverage here.
Committed/pushed to 10.1.x and cherry-picked back through to 9.5.x, thanks!
Comment #7
mfbFYI, this cherry-pick broke 9.5.x branch on PHP 7.3 - the property type declaration requires PHP 7.4
Comment #9
catchReverted on 9.5.x, we could probably recommit just with the type hint removed.
Comment #10
ravi.shankar commentedRemoved type hint from
$sqlQueryproperty.Comment #11
andypostQueued for 7.3
Comment #12
andypostpassed!
Comment #13
alexpottCommitted 3098069 and pushed to 9.5.x. Thanks!