Hi Gina,

On 25.06.24 16:36, Gina P. Banyard wrote:
Hello internals,

It is this time of year again where we proposed a list of deprecations to add 
in PHP 8.4:

https://wiki.php.net/rfc/deprecations_php_8_4

As a reminder, this list has been compiled over the course of the past year by 
various different people.

And as usual, each deprecation will be voted in isolation.

We still have a bit of time buffer, so if anyone else has any suggestions, they 
are free to add them to the RFC.

Some should be non-controversial, others a bit more.
If such, they might warrant their own dedicated RFC, or be dropped from the 
proposal altogether.

I would like to propose a deprecation of implicit cast to int of numeric strings using bit shift operators.

For the following reasons:
1. In PHP strings are byte arrays and without context it's not possible to know if "123" is actually a number or just three bytes of 0x313234 2. The other bitwise operators `|`, `&`, `~`, `^` already take it as byte array, only the bit shift operators try to be smart here 3. Non numeric strings already fail with "Unsupported operand types: string >> int" 4. This makes working with byte arrays unnecessary hard and forces you to use limited and system depending int's.

https://3v4l.org/IBUDD

While processing strings as byte arrays using bit shift operators needs a separate RFC, I think, if there is an agreement on deprecating this implicit cast it would already be beneficial to have this sooner than later.

What do you think?

Best regards,

Gina P. Banyard

Best,
Marc


Attachment: OpenPGP_0x3936ABF753BC88CE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to