Opened 8 years ago
Closed 8 years ago
#44927 closed enhancement (fixed)
Unnecessary is_null() call in get_avatar_data()
| Reported by: | JPry | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.1 |
| Component: | Users | Version: | |
| Severity: | minor | Keywords: | has-patch |
| Cc: | Focuses: |
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)
#3
in reply to: ↑ 2
@
8 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
@
8 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
@JPry check attached image for difference between isset and is_null.