|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-09-05 12:22 UTC] nicolas at gestixi dot com
-Summary: Add a configuration option to determine if reading an
undefined array key shoul
+Summary: Option to determine if reading an undefined array key
should throw a warning
[2021-09-05 12:22 UTC] nicolas at gestixi dot com
[2021-09-05 14:39 UTC] php-bugs at allenjb dot me dot uk
[2021-09-05 18:41 UTC] nicolas at gestixi dot com
[2021-09-06 01:50 UTC] requinix@php.net
-Status: Open
+Status: Wont fix
[2021-09-06 01:50 UTC] requinix@php.net
[2022-02-08 17:20 UTC] k dot andris at gmail dot com
[2022-02-09 07:00 UTC] nicolas at gestixi dot com
[2022-02-09 09:02 UTC] requinix@php.net
[2022-02-09 16:43 UTC] nicolas at gestixi dot com
[2022-02-10 11:59 UTC] cmb@php.net
[2022-02-15 11:49 UTC] imsop@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 21:00:02 2025 UTC |
Description: ------------ In some languages, such as JavaScript, accessing an undefined array key can be performed silently without throwing an error. We have a 10 years old code base which does conditions like this everywhere: `if ($array['key'])`. With PHP 8, this coding style throws a warning if the key is not defined. Replacing it by `if (array_key_exists('key', $array) && $array['key'])` would take us weeks... and, I actually prefer our actual syntax which I found more readable. For these reasons, I do not plan to upgrade all our code base to avoid this warning. And I do not want to ignore all warnings just for this one... Would it be possible to add a configuration setting to determine if this coding style should throw a warning, a notice or be silently ignored? Another solution I see would be to be able to ignore specific warnings/notices.