Opened 6 years ago
Closed 6 years ago
#44927 closed enhancement (fixed)
Unnecessary is_null() call in get_avatar_data()
Reported by: | JPry | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.1 | Priority: | normal |
Severity: | minor | Version: | |
Component: | Users | Keywords: | has-patch |
Focuses: | Cc: |
Description
In the get_avatar_data()
function, this check comes immediately after the pre_get_avatar_data
filter:
<?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).
Attachments (2)
Change History (14)
#1
@
6 years ago
- Component changed from General to Users
- Type changed from defect (bug) to enhancement
#3
in reply to:
↑ 2
@
6 years ago
Replying to mukesh27:
@JPry check attached image for difference between isset and is_null.
@mukesh27 I'm not sure what you're trying to show. I'm aware of the difference in isset()
and is_null()
, which is why I opened this ticket.
#5
in reply to:
↑ 4
@
6 years ago
Replying to mukesh27:
if
$args['url']
value is empty then isset is not working.
This is about the use of isset( $args['url'] ) $$ ! is_null( $args['url'] )
. It doesn't check using empty()
, and I don't think it should be using empty()
. This is because of the filter that comes directly above this statement. Please refer to the source code inline to see for yourself.
@JPry check attached image for difference between isset and is_null.