> Le 20 avr. 2022 à 00:22, Claude Pache <claude.pa...@gmail.com> a écrit : > > > >> Le 19 avr. 2022 à 20:20, Andreas Hennings <andr...@dqxtech.net> a écrit : >> >> A deprecation warning on is_callable() would imply that in a future >> version of PHP that call will be illegal. > > No, in the case of `is_callable()`, the deprecation warning will imply that, > in a future version of PHP, the behaviour will change. There are precedents > of deprecation warning for changing behaviour: https://3v4l.org/Iqo4N > <https://3v4l.org/Iqo4N> > > —Claude
Expanding my last message: Although we can technically use deprecation warning for anything reasonable (even without precedent), we should nevertheless be careful that it remains possible to write forward- and backward-compatible code without triggering that deprecation notice (and without resorting to the error suppression operator). For example, writing `strpos('x', chr(120))` instead of `strpos('x', 120)` will work fine in both 7.4 and 8.0 (in case it is really what was meant). In the case of `is_callable()`, it is true that it should in theory accept arbitrary input without notice. However, in practice, the value that `is_callable()` receives is almost never totally arbitrary: for instance, when it is fed with a string beginning with "static::", that particular prefix is almost surely written somewhere verbatim in your code, and you must change your code in some way in order to keep the intended behaviour in 9.0. By contrast, we shouldn’t use any type of notice for `password_verify()`, because that function must be prepared to accept *really* arbitrary strings. —Claude