note 93293 deleted from function.in-array by bjori

From: Date: Fri, 01 Jan 2010 17:35:47 +0000
Subject: note 93293 deleted from function.in-array by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-164521@lists.php.net to get a copy of this message
Note Submitter: urkle at outoforder dot cc ---- Just an FYI for anyone encountering strange issues with in_array. $a = array('edit','view','somethingelse',0); echo in_array('edit',$a) ? 'true' : 'false'; echo in_array('delete',$a) ? 'true' : 'false'; This returns "true" for both checks. instead of false for the second check. I encountered this while debugging an issue in mediawiki.. one of the addons I used defined the rights array incorrectly and added a "0" to the array so ALL RIGHTS CHECKS WERE TRUE!!!!. http://bugs.php.net/bug.php?id=8015 this bug report basically brushes off the obvious wrong behaviour as "you must use strict checking"

« previous php.notes (#164521) next »