Opened 8 hours ago
Last modified 6 hours ago
#49889 new enhancement
Image.php - Wrap Error Suppressors in WP_DEBUG Conditionals
Reported by: | Howdy_McGee | Owned by: | |
---|---|---|---|
Milestone: | 5.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Media | Keywords: | has-patch dev-feedback |
Focuses: | coding-standards | Cc: |
Description
Ideally, we want to remove all PHP error suppression flags. In some cases this may not be optimal so an alternative is to wrap any necessary suppressors in a WP_DEBUG conditional:
if( defined( 'WP_DEBUG' ) && WP_DEBUG ) { $imagesize = getimagesize( $file ); } else { $imagesize = @getimagesize( $file ); }
This ticket is to track anything and everything we can do to minimize the suppression flags in the image.php file.
Attachments (1)
Change History (4)
#1
@
7 hours ago
- Keywords has-patch dev-feedback added
This patch wraps all @
suppressed methods with WP DEBUG conditionals. If anyone has ideas to further minimize the suppressed methods please submit an additive patch. Related to #24780 ( Spreadsheet )
#2
@
7 hours ago
- Milestone changed from Awaiting Review to 5.5
Thanks for the patch!
With ~15 instances of @getimagesize()
in core, I think it would make sense to introduce wp_get_image_size()
as a wrapper with the defined( 'WP_DEBUG' ) && WP_DEBUG
check, to avoid repetition.
@iptcparse()
and @exif_read_data()
, on the other hand, are only used once or twice, so probably don't need a wrapper at this point.
WP_DEBUG Wrapped