Make WordPress Core


Ignore:
Timestamp:
01/16/2015 01:05:52 AM (10 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/ms-functions.php

    r31168 r31188  
    20062006 */
    20072007function is_user_spammy( $user = null ) {
    2008     if ( ! is_a( $user, 'WP_User' ) ) {
    2009         if ( $user )
     2008    if ( ! ( $user instanceof WP_User ) ) {
     2009        if ( $user ) {
    20102010            $user = get_user_by( 'login', $user );
    2011         else
     2011        } else {
    20122012            $user = wp_get_current_user();
     2013        }
    20132014    }
    20142015
Note: See TracChangeset for help on using the changeset viewer.