Make WordPress Core


Ignore:
Timestamp:
10/12/2023 02:34:12 PM (2 years ago)
Author:
davidbaumwald
Message:

Grouped backports to the 4.5 branch.

  • Comments: Prevent users who can not see a post from seeing comments on it.
  • Shortcodes: Restrict media shortcode ajax to certain type.
  • REST API: Ensure no-cache headers are sent when methods are overridden.
  • Prevent unintended behavior when certain objects are unserialized.

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

File:
1 edited

Legend:

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

    r39811 r56857  
    529529
    530530    /**
     531     * Perform reinitialization tasks.
     532     *
     533     * Prevents a callback from being injected during unserialization of an object.
     534     *
     535     * @return void
     536     */
     537    public function __wakeup() {
     538        if ( $this->parent && ! $this->parent instanceof self ) {
     539            throw new UnexpectedValueException();
     540        }
     541        if ( $this->headers && ! is_array( $this->headers ) ) {
     542            throw new UnexpectedValueException();
     543        }
     544        foreach ( $this->headers as $value ) {
     545            if ( ! is_string( $value ) ) {
     546                throw new UnexpectedValueException();
     547            }
     548        }
     549        $this->headers_sanitized = array();
     550    }
     551
     552    /**
    531553     * Adds theme data to cache.
    532554     *
     
    13721394        return strnatcasecmp( $a->display( 'Name', false, true ), $b->display( 'Name', false, true ) );
    13731395    }
     1396
     1397    private static function _check_headers_property_has_correct_type( $headers ) {
     1398        if ( ! is_array( $headers ) ) {
     1399            return false;
     1400        }
     1401        foreach ( $headers as $key => $value ) {
     1402            if ( ! is_string( $key ) || ! is_string( $value ) ) {
     1403                return false;
     1404            }
     1405        }
     1406        return true;
     1407    }
    13741408}
Note: See TracChangeset for help on using the changeset viewer.