# invalid array key/index not generating notices

- Thread: https://externals.io/message/27218
- Original archive: https://news-web.php.net/php.internals/27218
- Started by Sara Golemon on 2006-12-30T16:55:40+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #27218 — Sara Golemon — 2006-12-30T16:55:40+00:00

URL: https://externals.io/message/27218#27218

> I came across a subtle bug a developer introduced into our
 > application.  It took us a month to realize the bug was
 > there because PHP didn't throw a notice.
 >
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute.c?revision=1.755&view=markup

Down inside zend_fetch_dimension_address(), you'll find this block:

switch(Z_TYPE_P(container)) {

   /* ... */

   case IS_NULL: {
     /* for read-mode only */
     if (result) {
       result->var.ptr_ptr = &EG(uninitialized_zval_ptr);
       PZVAL_LOCK(*result->var.ptr_ptr);
     }
     if (type==BP_VAR_W || type==BP_VAR_RW) {
       zend_error(E_WARNING, "Cannot use a `NULL` value as an array");
     }
     break;
   }

   /* ... */
}

To me, that screams intentional, and since BC trumps reason, this isn't 
going to change.

-Sara
