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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to