Make WordPress Core


Ignore:
Timestamp:
10/12/2023 02:21:47 PM (20 months ago)
Author:
davidbaumwald
Message:

Grouped backports to the 4.1 branch.

  • Comments: Prevent users who can not see a post from seeing comments on it.
  • Shortcodes: Restrict ajax handler for media shortcode.
  • Prevent unintended behavior when certain objects are unserialized.

Merges [56835], [56836], and [56838] to the 4.1 branch.
Props xknown, jorbin, joehoyle, peterwilsoncc, ehtis, tykoted, antpb.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.1/src/wp-includes/class-wp-theme.php

    r39815 r56850  
    478478
    479479    /**
     480     * Perform reinitialization tasks.
     481     *
     482     * Prevents a callback from being injected during unserialization of an object.
     483     *
     484     * @return void
     485     */
     486    public function __wakeup() {
     487        if ( $this->parent && ! $this->parent instanceof self ) {
     488            throw new UnexpectedValueException();
     489        }
     490        if ( $this->headers && ! is_array( $this->headers ) ) {
     491            throw new UnexpectedValueException();
     492        }
     493        foreach ( $this->headers as $value ) {
     494            if ( ! is_string( $value ) ) {
     495                throw new UnexpectedValueException();
     496            }
     497        }
     498        $this->headers_sanitized = array();
     499    }
     500
     501    /**
    480502     * Adds theme data to cache.
    481503     *
     
    12331255        return strnatcasecmp( $a->display( 'Name', false, true ), $b->display( 'Name', false, true ) );
    12341256    }
     1257
     1258    private static function _check_headers_property_has_correct_type( $headers ) {
     1259        if ( ! is_array( $headers ) ) {
     1260            return false;
     1261        }
     1262        foreach ( $headers as $key => $value ) {
     1263            if ( ! is_string( $key ) || ! is_string( $value ) ) {
     1264                return false;
     1265            }
     1266        }
     1267        return true;
     1268    }
    12351269}
Note: See TracChangeset for help on using the changeset viewer.