Bug #14774 Updated: strpos with strtolower to working incorrectly

From: Date: Sun, 30 Dec 2001 15:54:04 +0000
Subject: Bug #14774 Updated: strpos with strtolower to working incorrectly
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-75360@lists.php.net to get a copy of this message
ID: 14774 Updated by: georg Reported By: armtuk@yahoo.com Status: Bogus Bug Type: Unknown/Other Function Operating System: Linux 2.4.9-7smp PHP Version: 4.0.6 New Comment: Sorry, but it works correct. In your sample $query has no "insert", therefore strpos returns 0 (not found), as desribed in the manual. Previous Comments: ------------------------------------------------------------------------ [2001-12-30 10:50:04] mfischer@php.net Thats the documented and expected behaviour. ------------------------------------------------------------------------ [2001-12-30 10:45:00] armtuk@yahoo.com <?php $query="insert into users (user_name) values 'user_name'"; if (strpos(strtolower($query),"select")==0) { print "FISH!"; } ?> Amazingly enough this prints FISH!. but: $query="insert into users (user_name) values 'user_name'"; if (strpos(strtolower($query),"select")==0&&!(strpos(strtolower($query,"select")===FALSE)) { print "FISH!"; } does not. ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=14774&edit=1

« previous php.dev (#75360) next »