Opened 3 years ago
Closed 3 years ago
#55699 closed defect (bug) (fixed)
posts_join_request filter is broken
Reported by: | 5um17 | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 6.0 | Priority: | normal |
Severity: | normal | Version: | 6.0 |
Component: | Query | Keywords: | has-patch has-unit-tests commit dev-reviewed |
Focuses: | Cc: |
Description (last modified by )
One of the users reported an error with WP 6.0-RC1.
On checking, I found posts_join_request
filter is stopped working since latest changes. First [52974] then [53175] for #54728.
I think this is an oversight, we missed adding compact()
to
<?php $clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( $clauses, &$this ) );
Attachments (5)
Change History (24)
#7
@
3 years ago
Replying to SergeyBiryukov:
I don't think we should rename the variable back to
$pieces
though, as using a consistent name was the point of [52974]. Just restoring the compact call, same as for theposts_clauses
filter in [53175] would fix the issue.
Thanks @SergeyBiryukov! I renamed the variable because $clauses
is being used two times in the code. And its value is changed after posts_clauses
filter.
I can see in 55699.2.diff you have reinitialized the variable which is good too. Thanks!
#8
@
3 years ago
55699.4.diff also includes a unit test for [53175].
It is worth noting that posts_clauses
and posts_clauses_request
were the only filters affected here. [53175] fixed the former, but missed the latter.
Other *_clauses
filters adjusted in [52974] and [53175] are unaffected because there are no hooks between the $clauses
array definition and the filter itself, so the logic for them has not changed.
#9
@
3 years ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 53370:
#10
@
3 years ago
- Keywords commit dev-feedback added
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening for backporting to the 6.0 branch after a second committer's review.
This ticket was mentioned in Slack in #core by chaion07. View the logs.
3 years ago
#12
follow-up:
↓ 13
@
3 years ago
- Keywords changes-requested added; commit dev-feedback removed
I'm concerned about [53370] and it needs additional work before it's ready to be merged in to the 6.0 branch.
In the new code, $clauses
undergoes four main definitions:
- The name of the MySQL sub-clauses
- The value of the MySQL sub-clauses
- The name of the MySQL sub-clauses
- The value of the MySQL sub-clauses
It took me quite a long time to figure out what was happening as a result.
As a defensive coding measure, two variables need to be used one for the names, one for the values of the clauses.
I see in the original patch the suggestion was pieces and clauses. I think this is preferable to what is in trunk at the moment, despite the inconsistency with other query classes.
#13
in reply to:
↑ 12
@
3 years ago
Replying to peterwilsoncc:
As a defensive coding measure, two variables need to be used one for the names, one for the values of the clauses.
I see in the original patch the suggestion was pieces and clauses. I think this is preferable to what is in trunk at the moment, despite the inconsistency with other query classes.
Sounds good, though if we're going to restore the $pieces
name, I would ideally prefer to do that consistently for all query classes, essentially reverting [52974], as I don't see a reason for them to be different, and appreciate consistency where possible. In hindsight, the reason for [52974] was that $clauses
seemed like a better name than $pieces
for the *_clauses
filter parameters, and I think that part can remain.
Does 55699.5.diff address the concern?
#14
@
3 years ago
I agree the consistency is a good idea.
For the purposes of the 6.0 back port , are you able to limit the commit to the buggy class only and do the renaming for consistency in a follow up commit.
Based on a visual review the patch and approach looks sound.
#17
@
3 years ago
- Keywords commit dev-feedback added; changes-requested removed
Marking [53375] for backporting to the 6.0 branch after a second committer's review.
[53376] can stay in trunk only, per comment:14.
#18
@
3 years ago
- Keywords dev-reviewed added; dev-feedback removed
Marking [53375] dev-reviewed
for 6.0-branch backporting per #comment:14.
Thanks for the report, moving to 6.0 for visibility.