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/class-wp-xmlrpc-server.php

    r31149 r31188  
    11181118
    11191119        // convert the date field back to IXR form
    1120         if ( isset( $content_struct['post_date'] ) && ! is_a( $content_struct['post_date'], 'IXR_Date' ) ) {
     1120        if ( isset( $content_struct['post_date'] ) && ! ( $content_struct['post_date'] instanceof IXR_Date ) ) {
    11211121            $content_struct['post_date'] = $this->_convert_date( $content_struct['post_date'] );
    11221122        }
     
    11241124        // ignore the existing GMT date if it is empty or a non-GMT date was supplied in $content_struct,
    11251125        // since _insert_post will ignore the non-GMT date if the GMT date is set
    1126         if ( isset( $content_struct['post_date_gmt'] ) && ! is_a( $content_struct['post_date_gmt'], 'IXR_Date' ) ) {
     1126        if ( isset( $content_struct['post_date_gmt'] ) && ! ( $content_struct['post_date_gmt'] instanceof IXR_Date ) ) {
    11271127            if ( $content_struct['post_date_gmt'] == '0000-00-00 00:00:00' || isset( $content_struct['post_date'] ) ) {
    11281128                unset( $content_struct['post_date_gmt'] );
Note: See TracChangeset for help on using the changeset viewer.