Re: [PHP-DEV] Setting to disable the "Undefined array index" warning

2022-02-15 Thread Larry Garfield
On Tue, Feb 15, 2022, at 6:54 AM, Andreas Leathley wrote: > On 15.02.22 13:31, Nicolas BADIA wrote: >> As it is explained in this ticket https://bugs.php.net/bug.php?id=81417 we >> use to check if a property exists by accessing it directly like we do in >> JavaScript. >> >> Personally, I subscrib

Re: [PHP-DEV] Setting to disable the "Undefined array index" warning

2022-02-15 Thread Rowan Tommins
On 15/02/2022 15:12, Guilliam Xavier wrote: On Tue, Feb 15, 2022 at 3:07 PM Rowan Tommins wrote: if ( array_key_exists('key', $array) && $array['key'] !== null && $array['key'] !== false && $array['key'] !== 0 && $array['key'] !== 0.0 && $array['key'] !== '' && $array['key'] !== [] ) Agreed,

Re: [PHP-DEV] Setting to disable the "Undefined array index" warning

2022-02-15 Thread Guilliam Xavier
On Tue, Feb 15, 2022 at 3:07 PM Rowan Tommins wrote: > On 15/02/2022 12:54, Andreas Leathley wrote: > > The problem with your way of writing code is that it is ambiguous in > > meaning, which is why this is a warning. > > > I think that's a good way of looking at it. There's actually quite a lot

Re: [PHP-DEV] Setting to disable the "Undefined array index" warning

2022-02-15 Thread Rowan Tommins
On 15/02/2022 12:54, Andreas Leathley wrote: The problem with your way of writing code is that it is ambiguous in meaning, which is why this is a warning. I think that's a good way of looking at it. There's actually quite a lot of code hiding a check like "if ($array['key'])"; roughly speakin

Re: [PHP-DEV] [RFC] [Under Discussion] Random Extension 4.0

2022-02-15 Thread Tim Düsterhus
Hi On 2/15/22 12:48, Go Kudo wrote: At first, I updated the RFC to the latest status. https://wiki.php.net/rfc/rng_extension Thank you, the examples are useful. I need some time to think about the current issue. I understand its usefulness, but I feel uncomfortable with the fact that the Nu

Re: [PHP-DEV] Setting to disable the "Undefined array index" warning

2022-02-15 Thread Pierre
Le 15/02/2022 à 13:46, Thomas Nunninger a écrit : Hi Nicolas, as far as I understand, adding new ini settings is not the way to go as this would mean that your code behaves differently on different environments. Two suggestions: * Write your own error handler that ignores those errors. * T

Re: [PHP-DEV] Setting to disable the "Undefined array index" warning

2022-02-15 Thread Andreas Leathley
On 15.02.22 13:31, Nicolas BADIA wrote: As it is explained in this ticket https://bugs.php.net/bug.php?id=81417 we use to check if a property exists by accessing it directly like we do in JavaScript. Personally, I subscribe to this coding style and we use it all over our codebase (more than 13

Re: [PHP-DEV] Setting to disable the "Undefined array index" warning

2022-02-15 Thread Thomas Nunninger
Hi Nicolas, as far as I understand, adding new ini settings is not the way to go as this would mean that your code behaves differently on different environments. Two suggestions: * Write your own error handler that ignores those errors. * Try some tool like Rector to rewrite your code. Bes

Re: [PHP-DEV] [RFC] [Under Discussion] Random Extension 4.0

2022-02-15 Thread Go Kudo
2022年2月15日(火) 19:03 Tim Düsterhus : > Hi > > On 2/15/22 04:58, Go Kudo wrote: > >> Regarding "unintuitive": I disagree. I find it unintuitive that there > are > > some RNG sequences that I can't access when providing a seed. > > > > This is also the case for RNG implementations in many other langu

[PHP-DEV] Re: RFC request

2022-02-15 Thread Christoph M. Becker
On 15.02.2022 at 12:06, Nicolas BADIA wrote: > Hi, > It looks like I need to request RFC karma for my username nicolasbadia > I’d like to start an internal discussion about this: > https://bugs.php.net/bug.php?id=81417 > We have big troubles with the warning 'Undefined array index’ and we’d like

Re: [PHP-DEV] [RFC] [Under Discussion] Random Extension 4.0

2022-02-15 Thread Tim Düsterhus
Hi On 2/15/22 04:58, Go Kudo wrote: Regarding "unintuitive": I disagree. I find it unintuitive that there are some RNG sequences that I can't access when providing a seed. This is also the case for RNG implementations in many other languages. For example, Java also uses long (64-bit) as the se