Am 02.12.2021 um 16:19 schrieb Sara Golemon <[email protected]>:
> I would say that such applications should consider unifying their own
> types. $a = $_GET['q'] ?? ''; Is there a place in the application where
> empty string and null would have been distinct? i.e. Is a search for
> nothing different from not searching?
Being able to detect if a parameter was present and empty or it it was not
present at all can be useful. That is the whole point of null, even though some
people dislike null :-)
In fact we ran into the same problem and are silencing certain notices,
warnings and deprecations because they get in the way of our code base.
(Side-note: We are patching it instead of suppressing it in an error handler as
we saw a noticeable performance difference.)
For the curious, here is our patch:
perl -0777 -i.bak -pe
's#zend_error.*E_(NOTICE|WARNING|DEPRECATED).*(\n.*)?(Undefined|Attempt to read
property|Uninitialized string offset|Trying to access array offset on value of
type|Passing null to parameter)#if (0) $&#g; s#zend_type_error.*must be of type
Countable#if(0) $&#g' Zend/*.[ch] ext/spl/*.[ch] ext/opcache/jit/*.[ch]
I am *not* advocating that other people should do this, I'm just corroborating
;-)
Regards,
- Chris