# Optional E_DEPRECATED for 8.0 in 7.4

- Thread: https://externals.io/message/112966
- Original archive: https://news-web.php.net/php.internals/112966
- Started by Alexander Kurilo via internals on 2021-01-22T21:13:30+00:00
- Messages: 1
- RFC: Saner string to number comparison (Implemented (PHP 8.0)) — https://externals.io/rfc/string_to_number_comparison.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #112966 — Alexander Kurilo via internals — 2021-01-22T21:13:30+00:00

URL: https://externals.io/message/112966#112966

Dear Internals,

Recently I started investigating how to migrate a fairly big project to 
PHP 8 and while most of the changes looked safe-ish, there was one that 
I was particularly worried about: few comparison rules were changed by 
"Saner String to Number Comparisons."[1]:

Comparison|  Before|  After
------------------------------
  0  ==  "foo"    |  true    |  false
  0  ==  ""       |  true    |  false

Would you consider adding a switch that, when turned on, issues a 
`E_DEPRECATED` on comparisons that are changed in 8.0 into 7.4? While 
it's kind of against semver, PHP doesn't strictly follow it anyways. It 
could be opt-in and I'm sure it can help migrating big applications with 
poorly tested logic that might rely on such comparisons. Nikita seems to 
have worked on this as there was a pull request on GitHub[2] that is now 
closed.

So, is there a chance for a similar patch (with a new ini setting to 
make it opt-in) to get in? Patching and building PHP manually is always 
an option but I think that's not only my me who would benefit from it. I 
assume, an RFC is required; if the feedback is positive, I'd volunteer 
to work on it; I'd appreciate some C-help later on, though, if it goes 
forward, because I barely can C myself.

What do you think?


[1]: https://wiki.php.net/rfc/string_to_number_comparison

[2]: https://github.com/php/php-src/pull/3917
