php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4762 while() exits when substr() returns 0
Submitted: 2000-06-01 19:57 UTC Modified: 2000-06-01 20:22 UTC
From: babbos at silom dot delta dot edu dot gr Assigned:
Status: Closed Package: Performance problem
PHP Version: 3.0.16 OS: Win 98SE
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
20 - 2 = ?
Subscribe to this entry?

 
 [2000-06-01 19:57 UTC] babbos at silom dot delta dot edu dot gr
in a string check routin whitch checks the validity
of characters entered in a POST field i used
while () with substr(). If the string that substr() 
parses has 0 (zero) in it, while() exits while it should
not.

e.g.
$i=0;
while ($ch=substr($field_name,$i)
{
print"$ch";
$i++;
}

if $field_name has a 0 in it, while() exits while it
should exit with another false signal other than 0 (null maybe?)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-06-01 20:22 UTC] stas at cvs dot php dot net
Maybe, but this is not php bug, this is your bug. while exits when condition is false, and 0 means false.
And for sure this is not performance problem. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 10:01:29 2024 UTC