diff --git a/src/wp-includes/canonical.php b/src/wp-includes/canonical.php
index 4d373e13bd..487e04bb26 100644
|
a
|
b
|
|
| 27 | 27 | * or query in an attempt to figure the correct page to go to. |
| 28 | 28 | * |
| 29 | 29 | * @since 2.3.0 |
| | 30 | * @since 5.5.0 lift error supression from parse_url call |
| 30 | 31 | * |
| 31 | 32 | * @global WP_Rewrite $wp_rewrite WordPress rewrite component. |
| 32 | 33 | * @global bool $is_IIS |
| … |
… |
function redirect_canonical( $requested_url = null, $do_redirect = true ) { |
| 67 | 68 | $requested_url .= $_SERVER['REQUEST_URI']; |
| 68 | 69 | } |
| 69 | 70 | |
| 70 | | $original = @parse_url( $requested_url ); |
| | 71 | $original = parse_url( $requested_url ); |
| 71 | 72 | if ( false === $original ) { |
| 72 | 73 | return; |
| 73 | 74 | } |
| … |
… |
function redirect_canonical( $requested_url = null, $do_redirect = true ) { |
| 407 | 408 | $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] ); |
| 408 | 409 | if ( $redirect_url && ! empty( $redirect['query'] ) ) { |
| 409 | 410 | parse_str( $redirect['query'], $_parsed_query ); |
| 410 | | $redirect = @parse_url( $redirect_url ); |
| | 411 | $redirect = parse_url( $redirect_url ); |
| 411 | 412 | |
| 412 | 413 | if ( ! empty( $_parsed_query['name'] ) && ! empty( $redirect['query'] ) ) { |
| 413 | 414 | parse_str( $redirect['query'], $_parsed_redirect_query ); |
| … |
… |
function redirect_canonical( $requested_url = null, $do_redirect = true ) { |
| 425 | 426 | } |
| 426 | 427 | |
| 427 | 428 | if ( $redirect_url ) { |
| 428 | | $redirect = @parse_url( $redirect_url ); |
| | 429 | $redirect = parse_url( $redirect_url ); |
| 429 | 430 | } |
| 430 | 431 | |
| 431 | 432 | // www.example.com vs. example.com |
| 432 | | $user_home = @parse_url( home_url() ); |
| | 433 | $user_home = parse_url( home_url() ); |
| 433 | 434 | if ( ! empty( $user_home['host'] ) ) { |
| 434 | 435 | $redirect['host'] = $user_home['host']; |
| 435 | 436 | } |
| … |
… |
function redirect_canonical( $requested_url = null, $do_redirect = true ) { |
| 629 | 630 | * DO NOT use this in plugin code. |
| 630 | 631 | * |
| 631 | 632 | * @since 3.4.0 |
| | 633 | * @since 5.5.0 lift error suppression from parse_url call |
| 632 | 634 | * @access private |
| 633 | 635 | * |
| 634 | 636 | * @param string $query_string |
| … |
… |
function redirect_canonical( $requested_url = null, $do_redirect = true ) { |
| 637 | 639 | * @return string The altered query string |
| 638 | 640 | */ |
| 639 | 641 | function _remove_qs_args_if_not_in_url( $query_string, array $args_to_check, $url ) { |
| 640 | | $parsed_url = @parse_url( $url ); |
| | 642 | $parsed_url = parse_url( $url ); |
| 641 | 643 | if ( ! empty( $parsed_url['query'] ) ) { |
| 642 | 644 | parse_str( $parsed_url['query'], $parsed_query ); |
| 643 | 645 | foreach ( $args_to_check as $qv ) { |
| … |
… |
function _remove_qs_args_if_not_in_url( $query_string, array $args_to_check, $ur |
| 655 | 657 | * Strips the #fragment from a URL, if one is present. |
| 656 | 658 | * |
| 657 | 659 | * @since 4.4.0 |
| | 660 | * @since 5.5.0 lift error suppression from parse_url call |
| 658 | 661 | * |
| 659 | 662 | * @param string $url The URL to strip. |
| 660 | 663 | * @return string The altered URL. |
| 661 | 664 | */ |
| 662 | 665 | function strip_fragment_from_url( $url ) { |
| 663 | | $parsed_url = @parse_url( $url ); |
| | 666 | $parsed_url = parse_url( $url ); |
| 664 | 667 | if ( ! empty( $parsed_url['host'] ) ) { |
| 665 | 668 | // This mirrors code in redirect_canonical(). It does not handle every case. |
| 666 | 669 | $url = $parsed_url['scheme'] . '://' . $parsed_url['host']; |
diff --git a/src/wp-includes/class-http.php b/src/wp-includes/class-http.php
index fd759b7347..ee6a1a8c3a 100644
|
a
|
b
|
class WP_Http { |
| 249 | 249 | * Returning any other value may result in unexpected behaviour. |
| 250 | 250 | * |
| 251 | 251 | * @since 2.9.0 |
| | 252 | * @since 5.5.0 lift error suppression from parse_url call |
| 252 | 253 | * |
| 253 | 254 | * @param false|array|WP_Error $preempt Whether to preempt an HTTP request's return value. Default false. |
| 254 | 255 | * @param array $parsed_args HTTP request arguments. |
| … |
… |
class WP_Http { |
| 269 | 270 | } |
| 270 | 271 | } |
| 271 | 272 | |
| 272 | | $arrURL = @parse_url( $url ); |
| | 273 | $arrURL = parse_url( $url ); |
| 273 | 274 | |
| 274 | 275 | if ( empty( $url ) || empty( $arrURL['scheme'] ) ) { |
| 275 | 276 | $response = new WP_Error( 'http_request_failed', __( 'A valid URL was not provided.' ) ); |
diff --git a/src/wp-includes/class-wp-http-cookie.php b/src/wp-includes/class-wp-http-cookie.php
index fb3861383e..538f2b5f64 100644
|
a
|
b
|
class WP_Http_Cookie { |
| 76 | 76 | * |
| 77 | 77 | * @since 2.8.0 |
| 78 | 78 | * @since 5.2.0 Added `host_only` to the `$data` parameter. |
| | 79 | * @since 5.5.0 lift error suppression from parse_url call |
| 79 | 80 | * |
| 80 | 81 | * @param string|array $data { |
| 81 | 82 | * Raw cookie data as header string or data array. |
| … |
… |
class WP_Http_Cookie { |
| 93 | 94 | */ |
| 94 | 95 | public function __construct( $data, $requested_url = '' ) { |
| 95 | 96 | if ( $requested_url ) { |
| 96 | | $arrURL = @parse_url( $requested_url ); |
| | 97 | $arrURL = parse_url( $requested_url ); |
| 97 | 98 | } |
| 98 | 99 | if ( isset( $arrURL['host'] ) ) { |
| 99 | 100 | $this->domain = $arrURL['host']; |
diff --git a/src/wp-includes/class-wp-http-proxy.php b/src/wp-includes/class-wp-http-proxy.php
index 37752c001a..5afa2590d2 100644
|
a
|
b
|
class WP_HTTP_Proxy { |
| 159 | 159 | * hosts that won't be sent through the proxy. |
| 160 | 160 | * |
| 161 | 161 | * @since 2.8.0 |
| | 162 | * @since 5.5.0 lift error suppression from parse_url call |
| 162 | 163 | * |
| 163 | 164 | * @staticvar array|null $bypass_hosts |
| 164 | 165 | * @staticvar array $wildcard_regex |
| … |
… |
class WP_HTTP_Proxy { |
| 171 | 172 | * parse_url() only handles http, https type URLs, and will emit E_WARNING on failure. |
| 172 | 173 | * This will be displayed on sites, which is not reasonable. |
| 173 | 174 | */ |
| 174 | | $check = @parse_url( $uri ); |
| | 175 | $check = parse_url( $uri ); |
| 175 | 176 | |
| 176 | 177 | // Malformed URL, can not process, but this could mean ssl, so let through anyway. |
| 177 | 178 | if ( false === $check ) { |
diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php
index 0da7d13e42..c7e3249522 100644
|
a
|
b
|
function generic_ping( $post_id = 0 ) { |
| 2803 | 2803 | * |
| 2804 | 2804 | * @since 0.71 |
| 2805 | 2805 | * @since 4.7.0 `$post_id` can be a WP_Post object. |
| | 2806 | * @since 5.5.0 lift error suppression from parse_url call |
| 2806 | 2807 | * |
| 2807 | 2808 | * @param string $content Post content to check for links. If empty will retrieve from post. |
| 2808 | 2809 | * @param int|WP_Post $post_id Post Object or ID. |
| … |
… |
function pingback( $content, $post_id ) { |
| 2846 | 2847 | if ( ! in_array( $link_test, $pung, true ) && ( url_to_postid( $link_test ) != $post->ID ) |
| 2847 | 2848 | // Also, let's never ping local attachments. |
| 2848 | 2849 | && ! is_local_attachment( $link_test ) ) { |
| 2849 | | $test = @parse_url( $link_test ); |
| | 2850 | $test = parse_url( $link_test ); |
| 2850 | 2851 | if ( $test ) { |
| 2851 | 2852 | if ( isset( $test['query'] ) ) { |
| 2852 | 2853 | $post_links[] = $link_test; |
diff --git a/src/wp-includes/feed.php b/src/wp-includes/feed.php
index 49c262d1ed..5ac9100858 100644
|
a
|
b
|
function rss2_site_icon() { |
| 618 | 618 | * Returns the link for the currently displayed feed. |
| 619 | 619 | * |
| 620 | 620 | * @since 5.3.0 |
| | 621 | * @since 5.5.0 lift error suppression from parse_url call |
| 621 | 622 | * |
| 622 | 623 | * @return string Correct link for the atom:self element. |
| 623 | 624 | */ |
| 624 | 625 | function get_self_link() { |
| 625 | | $host = @parse_url( home_url() ); |
| | 626 | $host = parse_url( home_url() ); |
| 626 | 627 | return set_url_scheme( 'http://' . $host['host'] . wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
| 627 | 628 | } |
| 628 | 629 | |
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index bc9f276b89..9bdc049271 100644
|
a
|
b
|
function wp_extract_urls( $content ) { |
| 825 | 825 | * @since 1.5.0 |
| 826 | 826 | * @since 5.3.0 The `$content` parameter was made optional, and the `$post` parameter was |
| 827 | 827 | * updated to accept a post ID or a WP_Post object. |
| | 828 | * @since 5.5.0 lift error suppression from parse_url call |
| 828 | 829 | * |
| 829 | 830 | * @global wpdb $wpdb WordPress database abstraction object. |
| 830 | 831 | * |
| … |
… |
function do_enclose( $content = null, $post ) { |
| 866 | 867 | foreach ( (array) $post_links_temp as $link_test ) { |
| 867 | 868 | // If we haven't pung it already. |
| 868 | 869 | if ( ! in_array( $link_test, $pung, true ) ) { |
| 869 | | $test = @parse_url( $link_test ); |
| | 870 | $test = parse_url( $link_test ); |
| 870 | 871 | if ( false === $test ) { |
| 871 | 872 | continue; |
| 872 | 873 | } |
| … |
… |
function do_enclose( $content = null, $post ) { |
| 901 | 902 | $allowed_types = array( 'video', 'audio' ); |
| 902 | 903 | |
| 903 | 904 | // Check to see if we can figure out the mime type from the extension. |
| 904 | | $url_parts = @parse_url( $url ); |
| | 905 | $url_parts = parse_url( $url ); |
| 905 | 906 | if ( false !== $url_parts ) { |
| 906 | 907 | $extension = pathinfo( $url_parts['path'], PATHINFO_EXTENSION ); |
| 907 | 908 | if ( ! empty( $extension ) ) { |
| … |
… |
function add_magic_quotes( $array ) { |
| 1233 | 1234 | * HTTP request for URI to retrieve content. |
| 1234 | 1235 | * |
| 1235 | 1236 | * @since 1.5.1 |
| | 1237 | * @since 5.5.0 lift error suppression from parse_url call |
| 1236 | 1238 | * |
| 1237 | 1239 | * @see wp_safe_remote_get() |
| 1238 | 1240 | * |
| … |
… |
function add_magic_quotes( $array ) { |
| 1240 | 1242 | * @return string|false HTTP content. False on failure. |
| 1241 | 1243 | */ |
| 1242 | 1244 | function wp_remote_fopen( $uri ) { |
| 1243 | | $parsed_url = @parse_url( $uri ); |
| | 1245 | $parsed_url = parse_url( $uri ); |
| 1244 | 1246 | |
| 1245 | 1247 | if ( ! $parsed_url || ! is_array( $parsed_url ) ) { |
| 1246 | 1248 | return false; |
diff --git a/src/wp-includes/http.php b/src/wp-includes/http.php
index 792482cd9f..0c5d64baf9 100644
|
a
|
b
|
function send_origin_headers() { |
| 511 | 511 | * Validate a URL for safe use in the HTTP API. |
| 512 | 512 | * |
| 513 | 513 | * @since 3.5.2 |
| | 514 | * @since 5.5.0 lift error suppression from parse_url call |
| 514 | 515 | * |
| 515 | 516 | * @param string $url Request URL. |
| 516 | 517 | * @return string|false URL or false on failure. |
| … |
… |
function wp_http_validate_url( $url ) { |
| 522 | 523 | return false; |
| 523 | 524 | } |
| 524 | 525 | |
| 525 | | $parsed_url = @parse_url( $url ); |
| | 526 | $parsed_url = parse_url( $url ); |
| 526 | 527 | if ( ! $parsed_url || empty( $parsed_url['host'] ) ) { |
| 527 | 528 | return false; |
| 528 | 529 | } |
| … |
… |
function wp_http_validate_url( $url ) { |
| 535 | 536 | return false; |
| 536 | 537 | } |
| 537 | 538 | |
| 538 | | $parsed_home = @parse_url( get_option( 'home' ) ); |
| | 539 | $parsed_home = parse_url( get_option( 'home' ) ); |
| 539 | 540 | |
| 540 | 541 | if ( isset( $parsed_home['host'] ) ) { |
| 541 | 542 | $same_host = strtolower( $parsed_home['host'] ) === strtolower( $parsed_url['host'] ); |
| … |
… |
function ms_allowed_http_request_hosts( $is_external, $host ) { |
| 659 | 660 | * |
| 660 | 661 | * @since 4.4.0 |
| 661 | 662 | * @since 4.7.0 The `$component` parameter was added for parity with PHP's `parse_url()`. |
| | 663 | * @since 5.5.0 lift error suppression from parse_url call |
| 662 | 664 | * |
| 663 | 665 | * @link https://www.php.net/manual/en/function.parse-url.php |
| 664 | 666 | * |
| … |
… |
function wp_parse_url( $url, $component = -1 ) { |
| 684 | 686 | $url = 'placeholder://placeholder' . $url; |
| 685 | 687 | } |
| 686 | 688 | |
| 687 | | $parts = @parse_url( $url ); |
| | 689 | $parts = parse_url( $url ); |
| 688 | 690 | |
| 689 | 691 | if ( false === $parts ) { |
| 690 | 692 | // Parsing failure. |
diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php
index c5899c6c36..ebf0480185 100644
|
a
|
b
|
if ( ! function_exists( 'wp_validate_redirect' ) ) : |
| 1406 | 1406 | * If the host is not allowed, then the redirect is to $default supplied |
| 1407 | 1407 | * |
| 1408 | 1408 | * @since 2.8.1 |
| | 1409 | * @since 5.5.0 lift error suppression from parse_url call |
| 1409 | 1410 | * |
| 1410 | 1411 | * @param string $location The redirect to validate |
| 1411 | 1412 | * @param string $default The value to return if $location is not allowed |
| … |
… |
if ( ! function_exists( 'wp_validate_redirect' ) ) : |
| 1424 | 1425 | $test = $cut ? substr( $location, 0, $cut ) : $location; |
| 1425 | 1426 | |
| 1426 | 1427 | // @-operator is used to prevent possible warnings in PHP < 5.3.3. |
| 1427 | | $lp = @parse_url( $test ); |
| | 1428 | $lp = parse_url( $test ); |
| 1428 | 1429 | |
| 1429 | 1430 | // Give up if malformed URL. |
| 1430 | 1431 | if ( false === $lp ) { |