#20319 [NEW]: array_diff error with array contain NULL values.

From: Date: Fri, 08 Nov 2002 20:36:00 +0000
Subject: #20319 [NEW]: array_diff error with array contain NULL values.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-24372@lists.php.net to get a copy of this message
From: yanik@lecourriel.com Operating system: Linux RedHat PHP version: 4.2.2 PHP Bug Type: Arrays related Bug description: array_diff error with array contain NULL values. This work !!! ------------------------------------------------ $arr1 = array('Color' => ''); $arr2 = array('Img1' => 3, 'Img2' => 2, 'Color' => 'Yellow'); print_r(array_diff($arr1, $arr2)); Return : Array ( [Color] => ) This not work!!! ------------------------------------------------ $arr1 = array('Color' => ''); $arr2 = array('Img1' => NULL, 'Img2' => 2, 'Color' => 'Yellow'); print_r(array_diff($arr1, $arr2)); Return : Array () This work !!! ------------------------------------------------ $arr1 = array('Color' => 'Red'); $arr2 = array('Img1' => NULL, 'Img2' => 2, 'Color' => 'Yellow'); print_r(array_diff($arr1, $arr2)); When your array contain NULL value the array diff does not recognize that Color is different. But if "Color" is not empty and different in both array the return value is corect. Sorry for my english ! Yanik -- Edit bug report at http://bugs.php.net/?id=20319&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=20319&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=20319&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=20319&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=20319&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=20319&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=20319&r=support Expected behavior: http://bugs.php.net/fix.php?id=20319&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=20319&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=20319&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=20319&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20319&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=20319&r=dst IIS Stability: http://bugs.php.net/fix.php?id=20319&r=isapi

« previous php.bugs (#24372) next »