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/category-template.php

    r31027 r31188  
    883883    $args = func_get_args();
    884884    // the user's options are the third parameter
    885     if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') )
     885    if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) {
    886886        $walker = new Walker_Category;
    887     else
     887    } else {
    888888        $walker = $args[2]['walker'];
    889 
     889    }
    890890    return call_user_func_array(array( &$walker, 'walk' ), $args );
    891891}
Note: See TracChangeset for help on using the changeset viewer.