Make WordPress Core


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

Grouped backports to the 4.3 branch.

  • Comments: Prevent users who can not see a post from seeing comments on it.
  • Shortcodes: Restrict ajax handler for media shortcode.
  • Prevent unintended behavior when certain objects are unserialized.

Merges [56835], [56836], and [56838] to the 4.1 branch.
Props xknown, jorbin, joehoyle, peterwilsoncc, ehtis, tykoted, antpb.

File:
1 edited

Legend:

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

    r39813 r56852  
    508508
    509509    /**
     510     * Perform reinitialization tasks.
     511     *
     512     * Prevents a callback from being injected during unserialization of an object.
     513     *
     514     * @return void
     515     */
     516    public function __wakeup() {
     517        if ( $this->parent && ! $this->parent instanceof self ) {
     518            throw new UnexpectedValueException();
     519        }
     520        if ( $this->headers && ! is_array( $this->headers ) ) {
     521            throw new UnexpectedValueException();
     522        }
     523        foreach ( $this->headers as $value ) {
     524            if ( ! is_string( $value ) ) {
     525                throw new UnexpectedValueException();
     526            }
     527        }
     528        $this->headers_sanitized = array();
     529    }
     530
     531    /**
    510532     * Adds theme data to cache.
    511533     *
     
    13041326        return strnatcasecmp( $a->display( 'Name', false, true ), $b->display( 'Name', false, true ) );
    13051327    }
     1328
     1329    private static function _check_headers_property_has_correct_type( $headers ) {
     1330        if ( ! is_array( $headers ) ) {
     1331            return false;
     1332        }
     1333        foreach ( $headers as $key => $value ) {
     1334            if ( ! is_string( $key ) || ! is_string( $value ) ) {
     1335                return false;
     1336            }
     1337        }
     1338        return true;
     1339    }
    13061340}
Note: See TracChangeset for help on using the changeset viewer.