Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Fix deprecation when passing null to esc_url #161

Merged
merged 2 commits into from
Jul 27, 2023

Conversation

xxsimoxx
Copy link
Member

In #123 and also in my logs
PHP Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated in .../httpdocs/wp-includes/formatting.php on line 4414
esc_url is throwing a deprecation.

Description

Return an empty string on esc_url( null ).
This is the current behavior of esc_url and in PHP>=8.1 is throwing a deprecation.

Note that esc_url( array() ) throws a fatal and that behavior is left intentionally unchanged.

How has this been tested?

Local testing and unit test.

Types of changes

  • Bug fix

Closes #123.

@xxsimoxx xxsimoxx requested a review from mattyrob July 24, 2023 11:52
Copy link
Collaborator

@mattyrob mattyrob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mattyrob mattyrob merged commit c46e708 into ClassicPress:develop Jul 27, 2023
@xxsimoxx xxsimoxx deleted the fix/formatting branch July 27, 2023 17:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐞 Issues reported in debug.log
3 participants