Make WordPress Core


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

Grouped backports to the 4.8 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.
  • REST API: Limit search_columns for users without list_users.
  • Prevent unintended behavior when certain objects are unserialized.

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

File:
1 edited

Legend:

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

    r40301 r56864  
    548548
    549549        /**
     550         * Perform reinitialization tasks.
     551         *
     552         * Prevents a callback from being injected during unserialization of an object.
     553         *
     554         * @return void
     555         */
     556        public function __wakeup() {
     557                if ( $this->parent && ! $this->parent instanceof self ) {
     558                        throw new UnexpectedValueException();
     559                }
     560                if ( $this->headers && ! is_array( $this->headers ) ) {
     561                        throw new UnexpectedValueException();
     562                }
     563                foreach ( $this->headers as $value ) {
     564                        if ( ! is_string( $value ) ) {
     565                                throw new UnexpectedValueException();
     566                        }
     567                }
     568                $this->headers_sanitized = array();
     569        }
     570
     571        /**
    550572         * Adds theme data to cache.
    551573         *
     
    15151537                return strnatcasecmp( $a->display( 'Name', false, true ), $b->display( 'Name', false, true ) );
    15161538        }
     1539
     1540        private static function _check_headers_property_has_correct_type( $headers ) {
     1541                if ( ! is_array( $headers ) ) {
     1542                        return false;
     1543                }
     1544                foreach ( $headers as $key => $value ) {
     1545                        if ( ! is_string( $key ) || ! is_string( $value ) ) {
     1546                                return false;
     1547                        }
     1548                }
     1549                return true;
     1550        }
    15171551}
Note: See TracChangeset for help on using the changeset viewer.