From:             alex at emailclick dot com
Operating system: Windows XP
PHP version:      5.2.9
PHP Bug Type:     Unknown/Other Function
Bug description:  array_intersect result shuffle

Description:
------------
There is a strange behaviour when I try to check the intersection between
two array (of keys (of filtered by callback arrays)).
The result of that operation is saved in an array which contains the value
at index 0 when the cycle is odd (1,3,5...). Instead the value will be
saved at index 1 when the cycle is pair (2,4,6...).

Reproduce code:
---------------
foreach($dates as $date){
foreach($machines as $model){
                if(!is_array($models[$model])) models[$model]=array();
                                $id=array_intersect(                            
        
array_keys(array_filter($data->data['udate'],create_function('$date','return
$date=="'.$date.'";'))),array_keys(array_filter($data->data['model'],create_function('$model','return
$model=="'.$model.'";'))));
                var_dump($id);echo '<br />';
        }
}

Expected result:
----------------
array(1) { [0]=>  int(0) }
array(1) { [0]=> int(1) }
array(1) { [0]=> int(2) }
array(1) { [0]=> int(3) } 

Actual result:
--------------
array(1) { [0]=>  int(0) }
array(1) { [1]=> int(1) }
array(1) { [0]=> int(2) }
array(1) { [1]=> int(3) } 

-- 
Edit bug report at http://bugs.php.net/?id=48492&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48492&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48492&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48492&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48492&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48492&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48492&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48492&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48492&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48492&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48492&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48492&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48492&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48492&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48492&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48492&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48492&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48492&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48492&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48492&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48492&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48492&r=mysqlcfg

Reply via email to