Bug#28151 Writing to Uninitialized Arrays

php.internals

Sara Golemon

22 years ago
Here's what I think is the fix for 28151 (I have no strong feelings on whether or not it belongs in the engine, but I am +1 on it personally). Zend guys? Index: Zend/zend_execute.c =================================================================== RCS file: /repository/ZendEngine2/zend_execute.c,v retrieving revision 1.643 diff -u -r1.643 zend_execute.c --- Zend/zend_execute.c 15 Apr 2004 21:32:34 -0000 1.643 +++ Zend/zend_execute.c 26 Apr 2004 05:06:59 -0000 @@ -919,6 +919,7 @@ SEPARATE_ZVAL(container_ptr); container = *container_ptr; } + zend_error(E_NOTICE, "Uninitialized array"); array_init(container); break; }

Derick Rethans

22 years ago
On Sun, 25 Apr 2004, Sara Golemon wrote:
> Here's what I think is the fix for 28151 (I have no strong feelings on > whether or not it belongs in the engine, but I am +1 on it personally). > Zend guys?
Did you run "make test" with this change? I have a feeling that'd break other things... Derick

Andi Gutmans

22 years ago
PHP has always allowed defining arrays on demand. This would break many scripts and I don't see any reason to force people to define variables as arrays, especially when these variables are undefined. Andi At 10:18 PM 4/25/2004 -0700, Sara Golemon wrote:

Sara Golemon

22 years ago
> >Here's what I think is the fix for 28151 (I have no strong feelings on > >whether or not it belongs in the engine, but I am +1 on it personally). > >Zend guys? > > > PHP has always allowed defining arrays on demand. This would break many > scripts and I don't see any reason to force people to define variables as > arrays, especially when these variables are undefined. >
As I said, I have no >strong< feelings on it, but how about E_STRICT? And more to the point of my original posting (which I didn't state clearly): Is that, in fact, the right place for such a notice to be? I'm more trying to sanity check my understanding of the engine here than anything. -Sara