Re: Revisiting RFC: Engine Warnings -- Undefined array index

From: Date: Tue, 13 Dec 2022 17:03:27 +0000
Subject: Re: Revisiting RFC: Engine Warnings -- Undefined array index
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-119134@lists.php.net to get a copy of this message
On 13 Dec 2022, at 15:45, Rowan Tommins <rowan.collins@gmail.com> wrote: > Although presumably they return null rather than an empty string precisely so that users can > check if the value was provided, without providing an extra method equivalent to > isset($_GET['q']), e.g. > > [...] > > For cases where you don't need that distinction, Laravel, Symfony, and CakePHP all allow a > default to be passed as the second parameter. Yep, that's right... but it's not easy to know if that distinction is needed for every single variable (why it's easier to work around this issue at the sinks, as Rector now does). I assume the next step is for PHP is to deprecate null coercion for all contests; e.g. concat ('Search: ' . $search), comparisons ('' != null), arithmetic, and the remaining functions like print()/echo()/sprintf('%s')... and then deprecate all other forms of coercion (e.g. 5 + '3')... because that will be fun :-) Craig

« previous php.internals (#119134) next »