Voting

: max(six, one)?
(Example: nine)

The Note You're Voting On

A simple developer
2 years ago
Attention when comparing object hashes in PHP >= 8.1

In PHP 8.1 (I think) the output of spl_object_hash() changed (see pull request https://github.com/php/php-src/pull/7010).
This lead to a strange misbehaviour of our application, as we stored object hashes in an array to check, if we processed object already. A simple in_array() check returned true, even though the current object hash was NOT actually in array.

Actual problem: New hashes are much more simple and can be something like "0000000000000e600000000000000000" or "0000000000000e490000000000000000", which PHP will interpret as numeric (exponent).
in_array() will compare non type-safe by default and will interpret named hashes as "0".

<< Back to user notes page

To Top