#44427 [Opn->Fbk]: stripos() and strpos() do not return false when needle is not found

From: Date: Thu, 13 Mar 2008 11:54:49 +0000
Subject: #44427 [Opn->Fbk]: stripos() and strpos() do not return false when needle is not found
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-123259@lists.php.net to get a copy of this message
ID: 44427 Updated by: jani@php.net -Summary: stripos strpos don't do false on needle not found Reported By: garichner at i2pmail dot org -Status: Open +Status: Feedback Bug Type: Strings related Operating System: S.u.S.E. 10.3 PHP Version: 5.2.5 New Comment: Please provide a short but _complete_ reproducing script. (one that starts with <?php, ends with ?> and can be simply copy'n'pasted to run. Previous Comments: ------------------------------------------------------------------------ [2008-03-13 10:31:19] garichner at i2pmail dot org Description: ------------ stripos strpos don't do false on needle not found foreach ($buffer_Infile1 as $VAL1) { foreach ($VAL1 as $VAL2){ $VAL2=trim($VAL2); $POSP=stripos($VAL1[0],"."); echo $VAL2." ".$POSP."\n"; } does this s.schaefer 1 sschaefer 1 but should to this s.schaefer 1 sschaefer 0 Reproduce code: --------------- foreach ($buffer_Infile1 as $VAL1) { foreach ($VAL1 as $VAL2){ $VAL2=trim($VAL2); $POSP=stripos($VAL1[0],"."); echo $VAL2." ".$POSP."\n"; } Expected result: ---------------- s.schaefer 1 sschaefer 0 Actual result: -------------- s.schaefer 1 sschaefer 1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44427&edit=1

« previous php.bugs (#123259) next »