#37762 [Opn->Bgs]: Array Associative in a for using the wrong key crash the system
| From: | mike@php.net | Date: | Fri, 09 Jun 2006 16:02:32 +0000 |
| Subject: | #37762 [Opn->Bgs]: Array Associative in a for using the wrong key crash the system | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-98245@lists.php.net to get a copy of this message | ||
ID: 37762
Updated by: mike@php.net
Reported By: bits dot e dot bytes at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Linux
PHP Version: 5.1.4
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
You create an endless loop.
Previous Comments:
------------------------------------------------------------------------
[2006-06-09 13:21:39] bits dot e dot bytes at gmail dot com
Description:
------------
When i make a for in a array associative, but using some wrong key like
numeric, this crash the system.
Please see the code
Reproduce code:
---------------
protected function getArray() {
$days = array();
for ($i = 31; $i > 0; $i--) {
$day = mktime (0, 0, 0, date("m") , date("d")-$i,
date("Y"));
if (date('w', $day) != 0 && date('w', $day) != 6 ){
$days[] = date('d/m/Y', $day);
}
}
$days = array_flip($days);
for ($i = 0; $i < count($days); $i++) {
//Here is the problem, becouse insted of use a correct key, i use a
number. In this point the system crash.
$days[$i] = 0;
}
return $days;
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37762&edit=1