Make WordPress Core


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

Grouped backports to the 4.4 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.4 branch.
Props xknown, jorbin, joehoyle, timothyblynjacobs, peterwilsoncc, ehtis, tykoted, antpb, rmccue.

File:
1 edited

Legend:

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

    r39812 r56855  
    520520
    521521    /**
     522     * Perform reinitialization tasks.
     523     *
     524     * Prevents a callback from being injected during unserialization of an object.
     525     *
     526     * @return void
     527     */
     528    public function __wakeup() {
     529        if ( $this->parent && ! $this->parent instanceof self ) {
     530            throw new UnexpectedValueException();
     531        }
     532        if ( $this->headers && ! is_array( $this->headers ) ) {
     533            throw new UnexpectedValueException();
     534        }
     535        foreach ( $this->headers as $value ) {
     536            if ( ! is_string( $value ) ) {
     537                throw new UnexpectedValueException();
     538            }
     539        }
     540        $this->headers_sanitized = array();
     541    }
     542
     543    /**
    522544     * Adds theme data to cache.
    523545     *
     
    13301352        return strnatcasecmp( $a->display( 'Name', false, true ), $b->display( 'Name', false, true ) );
    13311353    }
     1354
     1355    private static function _check_headers_property_has_correct_type( $headers ) {
     1356        if ( ! is_array( $headers ) ) {
     1357            return false;
     1358        }
     1359        foreach ( $headers as $key => $value ) {
     1360            if ( ! is_string( $key ) || ! is_string( $value ) ) {
     1361                return false;
     1362            }
     1363        }
     1364        return true;
     1365    }
    13321366}
Note: See TracChangeset for help on using the changeset viewer.