WordPress.org

Make WordPress Core

Ticket #49980: patch-49980.diff

File patch-49980.diff, 11.1 KB (added by netpassprodsr, 20 months ago)

includes all the function calls modified plus inserted PHP Doc statements

  • src/wp-includes/canonical.php

    diff --git a/src/wp-includes/canonical.php b/src/wp-includes/canonical.php
    index 4d373e13bd..487e04bb26 100644
    a b  
    2727 * or query in an attempt to figure the correct page to go to.
    2828 *
    2929 * @since 2.3.0
     30 * @since 5.5.0 lift error supression from parse_url call
    3031 *
    3132 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
    3233 * @global bool       $is_IIS
    function redirect_canonical( $requested_url = null, $do_redirect = true ) { 
    6768                $requested_url .= $_SERVER['REQUEST_URI'];
    6869        }
    6970
    70         $original = @parse_url( $requested_url );
     71        $original = parse_url( $requested_url );
    7172        if ( false === $original ) {
    7273                return;
    7374        }
    function redirect_canonical( $requested_url = null, $do_redirect = true ) { 
    407408        $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
    408409        if ( $redirect_url && ! empty( $redirect['query'] ) ) {
    409410                parse_str( $redirect['query'], $_parsed_query );
    410                 $redirect = @parse_url( $redirect_url );
     411                $redirect = parse_url( $redirect_url );
    411412
    412413                if ( ! empty( $_parsed_query['name'] ) && ! empty( $redirect['query'] ) ) {
    413414                        parse_str( $redirect['query'], $_parsed_redirect_query );
    function redirect_canonical( $requested_url = null, $do_redirect = true ) { 
    425426        }
    426427
    427428        if ( $redirect_url ) {
    428                 $redirect = @parse_url( $redirect_url );
     429                $redirect = parse_url( $redirect_url );
    429430        }
    430431
    431432        // www.example.com vs. example.com
    432         $user_home = @parse_url( home_url() );
     433        $user_home = parse_url( home_url() );
    433434        if ( ! empty( $user_home['host'] ) ) {
    434435                $redirect['host'] = $user_home['host'];
    435436        }
    function redirect_canonical( $requested_url = null, $do_redirect = true ) { 
    629630 * DO NOT use this in plugin code.
    630631 *
    631632 * @since 3.4.0
     633 * @since 5.5.0 lift error suppression from parse_url call
    632634 * @access private
    633635 *
    634636 * @param string $query_string
    function redirect_canonical( $requested_url = null, $do_redirect = true ) { 
    637639 * @return string The altered query string
    638640 */
    639641function _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 );
    641643        if ( ! empty( $parsed_url['query'] ) ) {
    642644                parse_str( $parsed_url['query'], $parsed_query );
    643645                foreach ( $args_to_check as $qv ) {
    function _remove_qs_args_if_not_in_url( $query_string, array $args_to_check, $ur 
    655657 * Strips the #fragment from a URL, if one is present.
    656658 *
    657659 * @since 4.4.0
     660 * @since 5.5.0 lift error suppression from parse_url call
    658661 *
    659662 * @param string $url The URL to strip.
    660663 * @return string The altered URL.
    661664 */
    662665function strip_fragment_from_url( $url ) {
    663         $parsed_url = @parse_url( $url );
     666        $parsed_url = parse_url( $url );
    664667        if ( ! empty( $parsed_url['host'] ) ) {
    665668                // This mirrors code in redirect_canonical(). It does not handle every case.
    666669                $url = $parsed_url['scheme'] . '://' . $parsed_url['host'];
  • src/wp-includes/class-http.php

    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 { 
    249249                 * Returning any other value may result in unexpected behaviour.
    250250                 *
    251251                 * @since 2.9.0
     252                 * @since 5.5.0 lift error suppression from parse_url call
    252253                 *
    253254                 * @param false|array|WP_Error $preempt     Whether to preempt an HTTP request's return value. Default false.
    254255                 * @param array                $parsed_args HTTP request arguments.
    class WP_Http { 
    269270                        }
    270271                }
    271272
    272                 $arrURL = @parse_url( $url );
     273                $arrURL = parse_url( $url );
    273274
    274275                if ( empty( $url ) || empty( $arrURL['scheme'] ) ) {
    275276                        $response = new WP_Error( 'http_request_failed', __( 'A valid URL was not provided.' ) );
  • src/wp-includes/class-wp-http-cookie.php

    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 { 
    7676         *
    7777         * @since 2.8.0
    7878         * @since 5.2.0 Added `host_only` to the `$data` parameter.
     79         * @since 5.5.0 lift error suppression from parse_url call
    7980         *
    8081         * @param string|array $data {
    8182         *     Raw cookie data as header string or data array.
    class WP_Http_Cookie { 
    9394         */
    9495        public function __construct( $data, $requested_url = '' ) {
    9596                if ( $requested_url ) {
    96                         $arrURL = @parse_url( $requested_url );
     97                        $arrURL = parse_url( $requested_url );
    9798                }
    9899                if ( isset( $arrURL['host'] ) ) {
    99100                        $this->domain = $arrURL['host'];
  • src/wp-includes/class-wp-http-proxy.php

    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 { 
    159159         * hosts that won't be sent through the proxy.
    160160         *
    161161         * @since 2.8.0
     162         * @since 5.5.0 lift error suppression from parse_url call
    162163         *
    163164         * @staticvar array|null $bypass_hosts
    164165         * @staticvar array      $wildcard_regex
    class WP_HTTP_Proxy { 
    171172                 * parse_url() only handles http, https type URLs, and will emit E_WARNING on failure.
    172173                 * This will be displayed on sites, which is not reasonable.
    173174                 */
    174                 $check = @parse_url( $uri );
     175                $check = parse_url( $uri );
    175176
    176177                // Malformed URL, can not process, but this could mean ssl, so let through anyway.
    177178                if ( false === $check ) {
  • src/wp-includes/comment.php

    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 ) { 
    28032803 *
    28042804 * @since 0.71
    28052805 * @since 4.7.0 `$post_id` can be a WP_Post object.
     2806 * @since 5.5.0 lift error suppression from parse_url call
    28062807 *
    28072808 * @param string $content Post content to check for links. If empty will retrieve from post.
    28082809 * @param int|WP_Post $post_id Post Object or ID.
    function pingback( $content, $post_id ) { 
    28462847                if ( ! in_array( $link_test, $pung, true ) && ( url_to_postid( $link_test ) != $post->ID )
    28472848                                // Also, let's never ping local attachments.
    28482849                                && ! is_local_attachment( $link_test ) ) {
    2849                         $test = @parse_url( $link_test );
     2850                        $test = parse_url( $link_test );
    28502851                        if ( $test ) {
    28512852                                if ( isset( $test['query'] ) ) {
    28522853                                        $post_links[] = $link_test;
  • src/wp-includes/feed.php

    diff --git a/src/wp-includes/feed.php b/src/wp-includes/feed.php
    index 49c262d1ed..5ac9100858 100644
    a b function rss2_site_icon() { 
    618618 * Returns the link for the currently displayed feed.
    619619 *
    620620 * @since 5.3.0
     621 * @since 5.5.0 lift error suppression from parse_url call
    621622 *
    622623 * @return string Correct link for the atom:self element.
    623624 */
    624625function get_self_link() {
    625         $host = @parse_url( home_url() );
     626        $host = parse_url( home_url() );
    626627        return set_url_scheme( 'http://' . $host['host'] . wp_unslash( $_SERVER['REQUEST_URI'] ) );
    627628}
    628629
  • src/wp-includes/functions.php

    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 ) { 
    825825 * @since 1.5.0
    826826 * @since 5.3.0 The `$content` parameter was made optional, and the `$post` parameter was
    827827 *              updated to accept a post ID or a WP_Post object.
     828 * @since 5.5.0 lift error suppression from parse_url call
    828829 *
    829830 * @global wpdb $wpdb WordPress database abstraction object.
    830831 *
    function do_enclose( $content = null, $post ) { 
    866867        foreach ( (array) $post_links_temp as $link_test ) {
    867868                // If we haven't pung it already.
    868869                if ( ! in_array( $link_test, $pung, true ) ) {
    869                         $test = @parse_url( $link_test );
     870                        $test = parse_url( $link_test );
    870871                        if ( false === $test ) {
    871872                                continue;
    872873                        }
    function do_enclose( $content = null, $post ) { 
    901902                                $allowed_types = array( 'video', 'audio' );
    902903
    903904                                // 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 );
    905906                                if ( false !== $url_parts ) {
    906907                                        $extension = pathinfo( $url_parts['path'], PATHINFO_EXTENSION );
    907908                                        if ( ! empty( $extension ) ) {
    function add_magic_quotes( $array ) { 
    12331234 * HTTP request for URI to retrieve content.
    12341235 *
    12351236 * @since 1.5.1
     1237 * @since 5.5.0 lift error suppression from parse_url call
    12361238 *
    12371239 * @see wp_safe_remote_get()
    12381240 *
    function add_magic_quotes( $array ) { 
    12401242 * @return string|false HTTP content. False on failure.
    12411243 */
    12421244function wp_remote_fopen( $uri ) {
    1243         $parsed_url = @parse_url( $uri );
     1245        $parsed_url = parse_url( $uri );
    12441246
    12451247        if ( ! $parsed_url || ! is_array( $parsed_url ) ) {
    12461248                return false;
  • src/wp-includes/http.php

    diff --git a/src/wp-includes/http.php b/src/wp-includes/http.php
    index 792482cd9f..0c5d64baf9 100644
    a b function send_origin_headers() { 
    511511 * Validate a URL for safe use in the HTTP API.
    512512 *
    513513 * @since 3.5.2
     514 * @since 5.5.0 lift error suppression from parse_url call
    514515 *
    515516 * @param string $url Request URL.
    516517 * @return string|false URL or false on failure.
    function wp_http_validate_url( $url ) { 
    522523                return false;
    523524        }
    524525
    525         $parsed_url = @parse_url( $url );
     526        $parsed_url = parse_url( $url );
    526527        if ( ! $parsed_url || empty( $parsed_url['host'] ) ) {
    527528                return false;
    528529        }
    function wp_http_validate_url( $url ) { 
    535536                return false;
    536537        }
    537538
    538         $parsed_home = @parse_url( get_option( 'home' ) );
     539        $parsed_home = parse_url( get_option( 'home' ) );
    539540
    540541        if ( isset( $parsed_home['host'] ) ) {
    541542                $same_host = strtolower( $parsed_home['host'] ) === strtolower( $parsed_url['host'] );
    function ms_allowed_http_request_hosts( $is_external, $host ) { 
    659660 *
    660661 * @since 4.4.0
    661662 * @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
    662664 *
    663665 * @link https://www.php.net/manual/en/function.parse-url.php
    664666 *
    function wp_parse_url( $url, $component = -1 ) { 
    684686                $url        = 'placeholder://placeholder' . $url;
    685687        }
    686688
    687         $parts = @parse_url( $url );
     689        $parts = parse_url( $url );
    688690
    689691        if ( false === $parts ) {
    690692                // Parsing failure.
  • src/wp-includes/pluggable.php

    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' ) ) : 
    14061406         * If the host is not allowed, then the redirect is to $default supplied
    14071407         *
    14081408         * @since 2.8.1
     1409         * @since 5.5.0 lift error suppression from parse_url call
    14091410         *
    14101411         * @param string $location The redirect to validate
    14111412         * @param string $default  The value to return if $location is not allowed
    if ( ! function_exists( 'wp_validate_redirect' ) ) : 
    14241425                $test = $cut ? substr( $location, 0, $cut ) : $location;
    14251426
    14261427                // @-operator is used to prevent possible warnings in PHP < 5.3.3.
    1427                 $lp = @parse_url( $test );
     1428                $lp = parse_url( $test );
    14281429
    14291430                // Give up if malformed URL.
    14301431                if ( false === $lp ) {