-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
PHP Deprecated: ltrim(): Passing null to parameter #59154 #5045
Conversation
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!
@NiharRan Ultra-rapid fix 😃 |
The change LGTM 👍 But it needs a test. I'll push a test to this PR shortly. |
3480618
to
ce94eeb
Compare
Seems the service is hiccuping
|
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
Running the new test locally on PHP 8.1 using the following command:
Before the fix, the test result:
After the fix, the test result:
One of the first things I consider is if the fix breaks BC (backward compatibility). In other words, is the result (except for the deprecation) the same? This is why I forced pushed the test to come before the fix, i.e. to test what the result is. Before the fix, the result is:
After the fix, an empty string is still returned. This can also be seen in action here across different PHP versions https://3v4l.org/7cIvT. Notice, all versions return an empty string, even on PHP 8.1+. This means: no BC break 🎉 |
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.
As noted here, the fix does indeed resolve the issue while maintaining BC of still returning an empty string.
LGTM 👍 Ready for commit.
Committed via https://core.trac.wordpress.org/changeset/56740. Thank you everyone for your contributions :) |
I added a check before filtering the link using the esc_url function.
function next_posts( $max_page = 0, $display = true ) {
$link = get_next_posts_page_link( $max_page );
}
Trac ticket: 59154