#49703 [Opn->Bgs]: The function returns false if the string is '0'
| From: | torben@php.net | Date: | Tue, 29 Sep 2009 06:55:47 +0000 |
| Subject: | #49703 [Opn->Bgs]: The function returns false if the string is '0' | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-2834@lists.php.net to get a copy of this message | ||
ID: 49703
Updated by: torben@php.net
Reported By: tech at sqlsurgeon dot com
-Status: Open
+Status: Bogus
Bug Type: Documentation problem
Operating System: Redhad
PHP Version: 5.3.0
New Comment:
The problem with your code is not in ctype_digit(), but in your test
for empty($tripSpace). '0' evaluates as FALSE; ergo, your test fails,
and your if() block executes. If you test ctype_digit('0');, you will
find that the result is in fact boolean TRUE.
Previous Comments:
------------------------------------------------------------------------
[2009-09-28 21:14:28] tech at sqlsurgeon dot com
Description:
------------
The function returns false if the string is '0'.
Reproduce code:
---------------
---
From manual page: function.ctype-digit#Notes
---
$tripSpace = '0';
if(empty($tripSpace)||!ctype_digit($tripSpace)){
$error = true;
echo "<p>TripSpace is $tripSpace</p>";
$posSpaceClass = "inValidField";
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49703&edit=1