Make WordPress Core


Ignore:
Timestamp:
10/12/2023 02:43:19 PM (8 months ago)
Author:
davidbaumwald
Message:

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

File:
1 edited

Legend:

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

    r39810 r56859  
    531531
    532532    /**
     533     * Perform reinitialization tasks.
     534     *
     535     * Prevents a callback from being injected during unserialization of an object.
     536     *
     537     * @return void
     538     */
     539    public function __wakeup() {
     540        if ( $this->parent && ! $this->parent instanceof self ) {
     541            throw new UnexpectedValueException();
     542        }
     543        if ( $this->headers && ! is_array( $this->headers ) ) {
     544            throw new UnexpectedValueException();
     545        }
     546        foreach ( $this->headers as $value ) {
     547            if ( ! is_string( $value ) ) {
     548                throw new UnexpectedValueException();
     549            }
     550        }
     551        $this->headers_sanitized = array();
     552    }
     553
     554    /**
    533555     * Adds theme data to cache.
    534556     *
     
    14411463        return strnatcasecmp( $a->display( 'Name', false, true ), $b->display( 'Name', false, true ) );
    14421464    }
     1465
     1466    private static function _check_headers_property_has_correct_type( $headers ) {
     1467        if ( ! is_array( $headers ) ) {
     1468            return false;
     1469        }
     1470        foreach ( $headers as $key => $value ) {
     1471            if ( ! is_string( $key ) || ! is_string( $value ) ) {
     1472                return false;
     1473            }
     1474        }
     1475        return true;
     1476    }
    14431477}
Note: See TracChangeset for help on using the changeset viewer.