#41269 [Opn->Fbk]: ctype_digit returns 1 for an empty string

From: Date: Thu, 03 May 2007 16:39:27 +0000
Subject: #41269 [Opn->Fbk]: ctype_digit returns 1 for an empty string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112204@lists.php.net to get a copy of this message
ID: 41269 Updated by: tony2001@php.net Reported By: sedat dot capar at isbank dot net dot tr -Status: Open +Status: Feedback Bug Type: Feature/Change Request Operating System: win2003 PHP Version: 5.2.2 New Comment: What are you talking about? # php -r 'var_dump(ctype_digit(""));' bool(false) # php -r 'var_dump(ctype_digit(" "));' bool(false) # php -r 'var_dump(ctype_digit("1"));' bool(true) Previous Comments: ------------------------------------------------------------------------ [2007-05-03 16:24:49] sedat dot capar at isbank dot net dot tr Description: ------------ ctype_digit returns 1 (TRUE) for an empty string (I do not mean a blank character) however it must return false (NULL) because empty string means there is no digit. Reproduce code: --------------- $number=""; print ctype_digit($number)."*"; $number=" "; print ctype_digit($number)."*"; $number="1"; print ctype_digit($number); Expected result: ---------------- **1 Actual result: -------------- 1**1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41269&edit=1

« previous php.bugs (#112204) next »