HTTP class contains redundant defined() check
|Reported by:||TobiasBg||Owned by:||nacin|
|Component:||HTTP API||Keywords:||has-patch commit|
Line 554 of wp-includes/class-http.php contains a somewhat redundant logic:
if ( ! defined('WP_HTTP_BLOCK_EXTERNAL') || ( defined('WP_HTTP_BLOCK_EXTERNAL') && WP_HTTP_BLOCK_EXTERNAL == false ) )
|will only be executed if the constant is defined, thus it's overhead to check that again. Also checking constants for false (like WP_HTTP_BLOCK_EXTERNAL == false) is not good practice.|
I have attached two patches, one that simply removes the redundant check and simplifies the WP_HTTP_BLOCK_EXTERNAL == false to ! WP_HTTP_BLOCK_EXTERNAL.
The second patch has the same logic, but has De Morgan's laws applied. I could decide what looks better :-)