Make WordPress Core


Ignore:
Timestamp:
10/12/2023 03:09:08 PM (19 months ago)
Author:
davidbaumwald
Message:

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

Location:
branches/5.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.5

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

    r48590 r56880  
    676676
    677677    /**
     678     * Perform reinitialization tasks.
     679     *
     680     * Prevents a callback from being injected during unserialization of an object.
     681     *
     682     * @return void
     683     */
     684    public function __wakeup() {
     685        if ( $this->parent && ! $this->parent instanceof self ) {
     686            throw new UnexpectedValueException();
     687        }
     688        if ( $this->headers && ! is_array( $this->headers ) ) {
     689            throw new UnexpectedValueException();
     690        }
     691        foreach ( $this->headers as $value ) {
     692            if ( ! is_string( $value ) ) {
     693                throw new UnexpectedValueException();
     694            }
     695        }
     696        $this->headers_sanitized = array();
     697    }
     698
     699    /**
    678700     * Adds theme data to cache.
    679701     *
     
    16591681        return strnatcasecmp( $a->name_translated, $b->name_translated );
    16601682    }
     1683
     1684    private static function _check_headers_property_has_correct_type( $headers ) {
     1685        if ( ! is_array( $headers ) ) {
     1686            return false;
     1687        }
     1688        foreach ( $headers as $key => $value ) {
     1689            if ( ! is_string( $key ) || ! is_string( $value ) ) {
     1690                return false;
     1691            }
     1692        }
     1693        return true;
     1694    }
    16611695}
Note: See TracChangeset for help on using the changeset viewer.