Make WordPress Core


Ignore:
Timestamp:
10/12/2023 03:04:07 PM (3 years ago)
Author:
davidbaumwald
Message:

Grouped backports to the 5.2 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 [56833], [56834], [56835], [56836], and [56838] to the 5.2 branch.
Props xknown, jorbin, joehoyle, timothyblynjacobs, peterwilsoncc, ehtis, tykoted, antpb, rmccue.

Location:
branches/5.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.2

  • branches/5.2/src/wp-includes/class-wp-theme.php

    r45080 r56876  
    632632
    633633        /**
     634         * Perform reinitialization tasks.
     635         *
     636         * Prevents a callback from being injected during unserialization of an object.
     637         *
     638         * @return void
     639         */
     640        public function __wakeup() {
     641                if ( $this->parent && ! $this->parent instanceof self ) {
     642                        throw new UnexpectedValueException();
     643                }
     644                if ( $this->headers && ! is_array( $this->headers ) ) {
     645                        throw new UnexpectedValueException();
     646                }
     647                foreach ( $this->headers as $value ) {
     648                        if ( ! is_string( $value ) ) {
     649                                throw new UnexpectedValueException();
     650                        }
     651                }
     652                $this->headers_sanitized = array();
     653        }
     654
     655        /**
    634656         * Adds theme data to cache.
    635657         *
     
    16091631                return strnatcasecmp( $a->name_translated, $b->name_translated );
    16101632        }
     1633
     1634        private static function _check_headers_property_has_correct_type( $headers ) {
     1635                if ( ! is_array( $headers ) ) {
     1636                        return false;
     1637                }
     1638                foreach ( $headers as $key => $value ) {
     1639                        if ( ! is_string( $key ) || ! is_string( $value ) ) {
     1640                                return false;
     1641                        }
     1642                }
     1643                return true;
     1644        }
    16111645}
Note: See TracChangeset for help on using the changeset viewer.