[wp-trac] [WordPress Trac] #49889: Image.php - Wrap Error Suppressors in WP_DEBUG Conditionals

WordPress Trac noreply at wordpress.org
Thu Jan 14 15:46:46 UTC 2021


#49889: Image.php - Wrap Error Suppressors in WP_DEBUG Conditionals
-------------------------------------------------+-------------------------
 Reporter:  Howdy_McGee                          |       Owner:
                                                 |  SergeyBiryukov
     Type:  enhancement                          |      Status:  reviewing
 Priority:  normal                               |   Milestone:  5.7
Component:  Media                                |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-dev-note needs-      |     Focuses:  coding-
  unit-tests                                     |  standards
-------------------------------------------------+-------------------------

Comment (by antpb):

 One note that @hellofromtonya mentioned in the recent Media Meeting that
 in PHP 8 the @ suppression of errors may have different behavior. Just
 reading through this article: https://php.watch/versions/8.0/fatal-error-
 suppression

 In my digging I found


 {{{
 In PHP 8.0, the @ operator does not suppress certain types of errors that
 were silenced prior to PHP 8.0. This includes the following types of
 errors:
 E_ERROR - Fatal run-time errors.
 E_CORE_ERROR - Fatal errors occurred in PHP's initial startup.
 E_COMPILE_ERROR - Fatal compile-time errors (from Zend engine).
 E_USER_ERROR - User-triggered errors with trigger_error() function.
 E_RECOVERABLE_ERROR - Catchable fatal error.
 E_PARSE - Compile-time parse errors.

 }}}

 So I think that the suppression here is safe, but we might want to
 consider why we're suppressing the errors for these and document it for
 future folks that are curious. I wasnt able to find why `@getimagesize` is
 being supressed.

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


More information about the wp-trac mailing list