[wp-trac] [WordPress Trac] #36561: Deprecated notices should be classified as such.

WordPress Trac noreply at wordpress.org
Mon Oct 2 19:14:31 UTC 2017


#36561: Deprecated notices should be classified as such.
-----------------------------------+-----------------------------
 Reporter:  jrf                    |       Owner:
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  Future Release
Component:  General                |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:
-----------------------------------+-----------------------------

Comment (by jrf):

 @johnbillion

 > I believe that the current error levels for deprecated calls,
 wrongdoings, etc is intentional.  Note that the default error level used
 by `error_log()` is `E_NOTICE`.

 I don't necessarily agree.
 I think it's more a choice of convenience as `E_(USER_)DEPRECATED` only
 became available in PHP 5.3.

 I also think that being explicit about the error level used would be
 better than relying on a silent default level.

 In the above proposal and the associated patches:
 * For doing it wrong, the error level doesn't change, it's just being made
 explicit.
 * For deprecated notices, the error level does change to the more
 appropriate `E_USER_DEPRECATED`.


 > We can't upgrade anything to an `E_WARNING` ...

 I'm not proposing to upgrade to `E_WARNING` anywhere as that would not be
 an appropriate choice anyway.

 > ... because they can become visible on the front end of a poorly
 configured server (eg one that has `WP_DEBUG` correctly set to false but
 which has `display_errors` enabled, and it'll also cause logs to fill up
 if they're configured to only log warnings.

 That has nothing to do with the error level chosen and is actually
 incorrect.

 If `display_errors` is set to `1` (enabled) and `WP_DEBUG` is set to
 `false`, error will NOT display on the screen. Those messages will also
 NOT go into the error log either.

 Both `display_errors` as well as `log_errors` respect the
 `error_reporting` setting and will not act on errors not covered by that.

 Setting `WP_DEBUG` to `false` effectively sets `error_reporting` to
 `E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING |
 E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR` which
 doesn't include `E_NOTICE` or `E_DEPRECATED`


 The PHP defaults are:
 `display_errors`: `1` (i.e. display)
 `error_reporting`: As stated in the PHP manual:
    >  PHP 5.3 or later, the default value is E_ALL & ~E_NOTICE & ~E_STRICT
 & ~E_DEPRECATED. This setting does not show E_NOTICE, E_STRICT and
 E_DEPRECATED level errors. You may want to show them during development.
 Prior to PHP 5.3.0, the default value is E_ALL & ~E_NOTICE & ~E_STRICT. In
 PHP 4 the default value is E_ALL & ~E_NOTICE.
 Ref: http://php.net/manual/en/errorfunc.configuration.php#ini.error-
 reporting


 > If we downgrade the `E_NOTICE` triggered by deprecated calls to
 `E_DEPRECATED`, I'm wary of this change causing deprecated usage to go
 unnoticed when a server is configured to log notices but not deprecated
 notices. Is this a common configuration?

 I think the most common configuration is the default as quoted above which
 doesn't include notices nor deprecation errors, so effectively this change
 would not make a difference for the default case.

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


More information about the wp-trac mailing list