Hi Daniel,

I am not sure that the mailing list is the best place to ask such a
question. In fact, this question already exists on Stack Overflow:
https://stackoverflow.com/q/71707325

As of PHP 8.4, this is still not an error. It was deprecated in PHP
8.1 and won't be turned into an error until at least PHP 9.0. The
deprecation of this confusing behaviour has been heavily contested,
but many agree that it is a good step forward. It is a step towards
making the user-defined functions and built-in functions consistent
with each other.

You say that $fieldValue in your code can be either a string or null,
but you don't explain why it can be null. Anytime you have a union of
two types, you need to design your code around it, so I presume you
have a good reason to allow null. Using ?? '’ is a cheap solution to
avoid the deprecation message, but it's not a good solution. You're
not really handling the null value in any meaningful way. You're
equating it to an empty string, so it begs the question of why the
value is a union of two types in the first place. So in summary, the
"error" isn't confusing or broken; your code is.

Your email isn't a very good discussion starter, so I imagine you
won't get many replies. I hope my explanation and the link to Stack
Overflow will help you in your current situation. I also encourage you
to read the mailing list rules if you haven't done so already:
https://github.com/php/php-src/blob/master/docs/mailinglist-rules.md

Regards,
Kamil Tekiela

Reply via email to