Make WordPress Core

Ticket #43231: 43231.1.patch

File 43231.1.patch, 4.0 KB (added by soulseekah, 7 years ago)

Initial patch

  • src/wp-includes/class-http.php

    diff --git src/wp-includes/class-http.php src/wp-includes/class-http.php
    index bead194..a72c396 100644
    class WP_Http { 
    440440
    441441                foreach ( $cookies as $name => $value ) {
    442442                        if ( $value instanceof WP_Http_Cookie ) {
    443                                 $cookie_jar[ $value->name ] = new Requests_Cookie( $value->name, $value->value, $value->get_attributes() );
     443                                $cookie_jar[ $value->name ] = new Requests_Cookie( $value->name, $value->value, $value->get_attributes(), array( 'host-only' => $value->host_only ) );
    444444                        } elseif ( is_scalar( $value ) ) {
    445445                                $cookie_jar[ $name ] = new Requests_Cookie( $name, $value );
    446446                        }
  • src/wp-includes/class-wp-http-cookie.php

    diff --git src/wp-includes/class-wp-http-cookie.php src/wp-includes/class-wp-http-cookie.php
    index 568fe48..3caf823 100644
    class WP_Http_Cookie { 
    6161        public $domain;
    6262
    6363        /**
     64         * host-only flag.
     65         *
     66         * @since trunk
     67         * @var bool
     68         */
     69        public $host_only;
     70
     71        /**
    6472         * Sets up this cookie object.
    6573         *
    6674         * The parameter $data should be either an associative array containing the indices names below
    class WP_Http_Cookie { 
    7179         * @param string|array $data {
    7280         *     Raw cookie data as header string or data array.
    7381         *
    74          *     @type string     $name    Cookie name.
    75          *     @type mixed      $value   Value. Should NOT already be urlencoded.
    76          *     @type string|int $expires Optional. Unix timestamp or formatted date. Default null.
    77          *     @type string     $path    Optional. Path. Default '/'.
    78          *     @type string     $domain  Optional. Domain. Default host of parsed $requested_url.
    79          *     @type int        $port    Optional. Port. Default null.
     82         *     @type string     $name      Cookie name.
     83         *     @type mixed      $value     Value. Should NOT already be urlencoded.
     84         *     @type string|int $expires   Optional. Unix timestamp or formatted date. Default null.
     85         *     @type string     $path      Optional. Path. Default '/'.
     86         *     @type string     $domain    Optional. Domain. Default host of parsed $requested_url.
     87         *     @type int        $port      Optional. Port. Default null.
     88         *     @type bool       $host_only Optional. host-only storage flag. Default true.
    8089         * }
    8190         * @param string       $requested_url The URL which the cookie was set on, used for default $domain
    8291         *                                    and $port values.
    class WP_Http_Cookie { 
    128137                        }
    129138
    130139                        // Set properties based directly on parameters.
    131                         foreach ( array( 'name', 'value', 'path', 'domain', 'port' ) as $field ) {
     140                        foreach ( array( 'name', 'value', 'path', 'domain', 'port', 'host_only' ) as $field ) {
    132141                                if ( isset( $data[ $field ] ) ) {
    133142                                        $this->$field = $data[ $field ];
    134143                                }
  • src/wp-includes/class-wp-http-requests-response.php

    diff --git src/wp-includes/class-wp-http-requests-response.php src/wp-includes/class-wp-http-requests-response.php
    index df0957f..b6c5f24 100644
    class WP_HTTP_Requests_Response extends WP_HTTP_Response { 
    164164                foreach ( $this->response->cookies as $cookie ) {
    165165                        $cookies[] = new WP_Http_Cookie(
    166166                                array(
    167                                         'name'    => $cookie->name,
    168                                         'value'   => urldecode( $cookie->value ),
    169                                         'expires' => isset( $cookie->attributes['expires'] ) ? $cookie->attributes['expires'] : null,
    170                                         'path'    => isset( $cookie->attributes['path'] ) ? $cookie->attributes['path'] : null,
    171                                         'domain'  => isset( $cookie->attributes['domain'] ) ? $cookie->attributes['domain'] : null,
     167                                        'name'      => $cookie->name,
     168                                        'value'     => urldecode( $cookie->value ),
     169                                        'expires'   => isset( $cookie->attributes['expires'] ) ? $cookie->attributes['expires'] : null,
     170                                        'path'      => isset( $cookie->attributes['path'] ) ? $cookie->attributes['path'] : null,
     171                                        'domain'    => isset( $cookie->attributes['domain'] ) ? $cookie->attributes['domain'] : null,
     172                                        'host_only' => isset( $cookie->flags['host-only'] ) ? $cookie->flags['host-only'] : null,
    172173                                )
    173174                        );
    174175                }