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

WordPress Trac noreply at wordpress.org
Sun May 14 17:19:32 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:               |     Focuses:  performance
-------------------------+------------------------------

Comment (by costdev):

 Thanks for opening this ticket @Presskopp!

 > wp-includes/rest-api/fields/class-wp-rest-meta-fields.php, ~L.477
 > `if ( is_object( $value ) && ! ( $value instanceof JsonSerializable ) )
 {`

 Strangely, I couldn't find this line in that file or in any file in Core.
 Can you double-check this one?

 > wp-includes/class-json.php, ~L.929
 > `} elseif (is_object($data) && ($data instanceof services_json_error ||`

 This file has been deprecated since 5.3.0 as the PHP native JSON extension
 is now a [https://make.wordpress.org/hosting/handbook/server-environment
 /#php-extensions required extension].

 > wp-includes/media.php, ~L.3762
 > `|| is_object( $image ) && $image instanceof GdImage`
 >
 > wp-admin/includes/class-pclzip.php, ~L. 1174
 > `if (is_object($p_archive) && $p_archive instanceof pclzip)`
 >
 > wp-admin/includes/class-pclzip.php, ~L.1238
 > `if (is_object($p_archive_to_add) && $p_archive_to_add instanceof
 pclzip)`

 These three seem fine to change.

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


More information about the wp-trac mailing list