[Proposal] New error type E_DEPRECATED

php.internals

Davey

23 years ago
Hey, I was thinking that perhaps implementing a new error type, E_DEPRECATED might be a good idea for helping to advocate the deprecation of functions and such. It would simply work in that it shows a "notice" type message, that is only shown under E_ALL and if E_DEPRECATED is appended to the error_reporting php.ini line (or via error_reporting() function). Perhaps the message could link to documentation on why it has been deprecated/what it has been deprecated in favour of. It was also noted when discussed with others, that the PHP Doc team can automatically detect and document deprecated functions. The only thing this would really break is people _not_ using the constants, in which case they've been repeatedly warned not to do so ever since the last change (4.0.0). It was suggested that perhaps make E_DEPRECATED 2048 (Add #define E_DEPRECATED (1<<11L)) then add E_DEPRECATED to the #define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED) - Davey

(Marcus Börger)

23 years ago
Hello Davey, Wednesday, June 25, 2003, 4:52:18 AM, you wrote: D> Hey, D> I was thinking that perhaps implementing a new error type, E_DEPRECATED D> might be a good idea for helping to advocate the deprecation of D> functions and such. D> It would simply work in that it shows a "notice" type message, that is D> only shown under E_ALL and if E_DEPRECATED is appended to the D> error_reporting php.ini line (or via error_reporting() function). D> Perhaps the message could link to documentation on why it has been D> deprecated/what it has been deprecated in favour of. D> It was also noted when discussed with others, that the PHP Doc team can D> automatically detect and document deprecated functions. D> The only thing this would really break is people _not_ using the D> constants, in which case they've been repeatedly warned not to do so D> ever since the last change (4.0.0). D> It was suggested that perhaps make E_DEPRECATED 2048 (Add D> #define E_DEPRECATED (1<<11L)) then add E_DEPRECATED to the D> #define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | D> E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | D> E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED) Internally on the c side it's not that easy, because some error handling functions have to know how to handle the new error type. But if everything is in place we could also add a new function flag in the engine which triggers the 'deprecated' error whenever a deprecated function gets called.
-- Best regards, Marcus mailto:helly@php.net