Skip to content

Conversation

@mehrazmorshed
Copy link

parse_url() is discouraged because of inconsistency in the output across PHP versions; use wp_parse_url() instead.

parse_url() is discouraged because of inconsistency in the output across PHP versions; use wp_parse_url() instead.
@johnbillion
Copy link
Owner

Thanks for the PR @mehrazmorshed. Which inconsistencies are you referring to? (Query Monitor supports PHP 7.4 and higher.)

@p-windeurope
Copy link

From what I can see there were some inconsistencies in the PHP 5.x era (related to schemeless urls). Some new "inconsistencies" brought by PHP 8.0 - distinguishing between absent and empty query strings and fragments - don't seem to be normalized in wp_parse_url though.

If someone decides it's a good idea to overwrite (via add_filter) the home_url to something like /a:1 the return values for PHP_URL_SCHEME of parse_url and wp_parse_url would differ (false for PHP, NULL for WordPress). But that someone would probably have a bigger problem than just this... 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants