Make WordPress Core


Ignore:
Timestamp:
10/12/2023 02:48:17 PM (9 months ago)
Author:
davidbaumwald
Message:

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

File:
1 edited

Legend:

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

    r40326 r56862  
    532532
    533533    /**
     534     * Perform reinitialization tasks.
     535     *
     536     * Prevents a callback from being injected during unserialization of an object.
     537     *
     538     * @return void
     539     */
     540    public function __wakeup() {
     541        if ( $this->parent && ! $this->parent instanceof self ) {
     542            throw new UnexpectedValueException();
     543        }
     544        if ( $this->headers && ! is_array( $this->headers ) ) {
     545            throw new UnexpectedValueException();
     546        }
     547        foreach ( $this->headers as $value ) {
     548            if ( ! is_string( $value ) ) {
     549                throw new UnexpectedValueException();
     550            }
     551        }
     552        $this->headers_sanitized = array();
     553    }
     554
     555    /**
    534556     * Adds theme data to cache.
    535557     *
     
    14971519        return strnatcasecmp( $a->display( 'Name', false, true ), $b->display( 'Name', false, true ) );
    14981520    }
     1521
     1522    private static function _check_headers_property_has_correct_type( $headers ) {
     1523        if ( ! is_array( $headers ) ) {
     1524            return false;
     1525        }
     1526        foreach ( $headers as $key => $value ) {
     1527            if ( ! is_string( $key ) || ! is_string( $value ) ) {
     1528                return false;
     1529            }
     1530        }
     1531        return true;
     1532    }
    14991533}
Note: See TracChangeset for help on using the changeset viewer.