[wp-trac] [WordPress Trac] #58309: Save a few processing cycles by removing redundant is_object
WordPress Trac
noreply at wordpress.org
Sun May 14 20:54:41 UTC 2023
#58309: Save a few processing cycles by removing redundant is_object
------------------------------+--------------------------
Reporter: Presskopp | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 6.3
Component: General | Version:
Severity: normal | Resolution:
Keywords: has-patch commit | Focuses: performance
------------------------------+--------------------------
Changes (by costdev):
* keywords: has-patch => has-patch commit
* milestone: Awaiting Review => 6.3
Comment:
I've attached
[https://core.trac.wordpress.org/attachment/ticket/58309/58309.2.diff
58309.2.diff] which makes `$image instanceof GdImage` the first condition,
and updates the order of the checks mentioned in the docblock for good
measure.
- PHPUnit tests continue to pass.
- Milestoning for 6.3.
- Adding for `commit` consideration.
Committers: If this patch is ready for commit, we might consider turning
`is_gd_image()` into a one-liner. Not a big deal though.
{{{#!php
<?php
function is_gd_image( $image ) {
return $image instanceof GdImage || is_resource( $image ) && 'gd' ===
get_resource_type( $image );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58309#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list