-
Notifications
You must be signed in to change notification settings - Fork 817
Inline Search: Return when the_title filter is called with the incorrect number of parameters #43511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inline Search: Return when the_title filter is called with the incorrect number of parameters #43511
Conversation
It's been reported that at least one theme calls the_title() filter with the incorrect number of arguments, 1 instead of 2. This change should address that by returning early when handling title highlighting.
…n-improper-the_title-filter
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Search plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 1 file.
Full summary · PHP report · JS report Coverage check overridden by
Coverage tests to be added later
|
o2's behaviour is a bit more involved than it at first seemed. For the moment let's skip o2 based themes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works as described
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I tested it on PfsEZG-r-p2 and it looks good.
$body_class = get_body_class(); | ||
if ( is_array( $body_class ) && in_array( 'o2', $body_class, true ) ) { | ||
return $title; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Since get_body_class()
ultimately returns array_unique
, we might be able to simplify this check.
if ( in_array( 'o2', $body_class, true ) ) {
return $title;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good point, and I've given it some thought. I'm going to keep it as is, just in case there's a something out there filtering body_class
and not returning an array. I appreciate that this is probably overly defensive, but also this PR exists, so there we are. :)
…n-improper-the_title-filter
Fixes #p1747423124187819-slack-C02FMH4G8
Proposed changes:
This PR re-enables title highlighting for Inline Search if the active theme is not based on
o2
, which is being checked against for two reasons:Per the discussion above,
o2
has its ownthe_title
filter that doesn't pass the required number of parameters.o2
passes apost_title
but not apost_id
, which can lead to fatals. With checks for this in place...A
post_id
does eventually get passed, but post titles render with<mark>
tags visible as part of the title.Both of these need either a fix to
o2
(to pass the correct number of parameters) or potential changes to escaping, to allow<mark>
tags. Both should be addressed in future PRs.Other information:
Jetpack product discussion
N/A
Does this pull request change what data or activity we track or use?
N/A
Testing instructions:
bin/jetpack-downloader
script (command below), check out this branch on your sandbox.<mark>
tags on words that match your search term, e.g.,billing