isset() And The Fatal Error¶
isset() checks if a variable exists. By extension, it also checks array elements, object properties etc. As the check is performed, any attempt to access an undefined part of the expression is muted: this makes total sense.
For example, if one of the intermediate expression is an integer, it is not possible to access it with an array syntax, unlike an array or a string. Such access is a warning when used outside isset(), but is silent inside the isset().
This leads to a nice optimisation, where checking isset($a[1][2][3][4]) is sufficient to check isset($a), then isset($a[1]), isset($a[1][2]), isset($a[1][2][3]), and isset($a[1][2][3][4]). Nice.
The catch is when of the element inside the actual array is an object. PHP reports a fatal error when using an object with an array syntax (except may be for ArrayAccess objects). Then, isset() stops.
The reverse is not true: accessing an array with a object syntax yields a null and no warning. As it should be.
All this also applies to empty().
A change of behavior was suggested for PHP 8.5, but was down voted. May be in PHP 8.6?