From:             bits dot e dot bytes at gmail dot com
Operating system: Linux
PHP version:      5.1.4
PHP Bug Type:     Arrays related
Bug description:  Array Associative in a for using the wrong key crash the 
system

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 bug report at http://bugs.php.net/?id=37762&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37762&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=37762&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37762&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37762&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=37762&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37762&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37762&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37762&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37762&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37762&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=37762&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=37762&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37762&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37762&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37762&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37762&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37762&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37762&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37762&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37762&r=mysqlcfg

Reply via email to