[wp-trac] [WordPress Trac] #58309: Save a few processing cycles by removing redundant is_object

WordPress Trac noreply at wordpress.org
Sun May 14 18:39:15 UTC 2023


#58309: Save a few processing cycles by removing redundant is_object
-------------------------+------------------------------
 Reporter:  Presskopp    |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  performance
-------------------------+------------------------------

Comment (by Presskopp):

 I think we even can go for

 {{{if ( 'gd' === get_resource_type( $image ) || $image instanceof
 GdImage}}}

 because the function get_resource_type first checks if the given parameter
 is a resource and only if so, returns it's type, else 'unknown' (if I get
 this correctly):

 [https://github.com/php/php-
 src/blob/03f64b785366b44f651e996008209e042aa99548/Zend/zend_builtin_functions.c#L1359
 see zend_builtin_functions.c]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58309#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list