[wp-trac] [WordPress Trac] #44927: Unnecessary is_null() call in get_avatar_data()

WordPress Trac noreply at wordpress.org
Mon Sep 10 15:09:38 UTC 2018


#44927: Unnecessary is_null() call in get_avatar_data()
--------------------------+-----------------------------
 Reporter:  JPry          |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  minor         |   Keywords:  has-patch
  Focuses:                |
--------------------------+-----------------------------
 In the `get_avatar_data()` function, this check comes immediately after
 the `pre_get_avatar_data` filter:

 {{{#!php
 <?php
         if ( isset( $args['url'] ) && ! is_null( $args['url'] ) ) {
                 /** This filter is documented in wp-includes/link-
 template.php */
                 return apply_filters( 'get_avatar_data', $args,
 $id_or_email );
         }
 }}}

 The `! is_null()` portion of the condition is unnecessary, because
 `isset()` checks whether a variable is set **''and''** is not null
 (http://php.net/manual/en/function.isset.php).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44927>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list