WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/16/2015 01:05:52 AM (5 years ago)
Author:
wonderboymusic
Message:

In PHP 5.0.0, is_a() became deprecated in favour of the instanceof operator. Calling is_a() would result in an E_STRICT warning.

In PHP 5.3.0, is_a() is no longer deprecated, and will therefore no longer throw E_STRICT warnings.

To avoid warnings in PHP < 5.3.0, convert all is_a() calls to $var instanceof WP_Class calls.

instanceof does not throw any error if the variable being tested is not an object, it simply returns false.

Props markoheijnen, wonderboymusic.
Fixes #25672.

File:
1 edited

Legend:

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

    r31108 r31188  
    275275        if ( $this->template != $this->stylesheet ) {
    276276            // If we are a parent, then there is a problem. Only two generations allowed! Cancel things out.
    277             if ( is_a( $_child, 'WP_Theme' ) && $_child->template == $this->stylesheet ) {
     277            if ( $_child instanceof WP_Theme && $_child->template == $this->stylesheet ) {
    278278                $_child->parent = null;
    279279                $_child->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), $_child->template ) );
Note: See TracChangeset for help on using the changeset viewer.