#42007 [Opn]: ctype_alnum( int ) will return false
| From: | jani@php.net | Date: | Mon, 16 Jul 2007 18:19:24 +0000 |
| Subject: | #42007 [Opn]: ctype_alnum( int ) will return false | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969377054@lists.php.net to get a copy of this message | ||
ID: 42007
Updated by: jani@php.net
Reported By: adrian dot gheorghe at gmail dot com
Status: Open
-Bug Type: Unknown/Other Function
+Bug Type: Documentation problem
Operating System: Windows XP Sp2
PHP Version: 5.2.3
New Comment:
Documentation shouldn't say it's equivalent to regex matching when it
really isn't..docs need update, the function is fine as is.
Previous Comments:
------------------------------------------------------------------------
[2007-07-16 10:54:07] adrian dot gheorghe at gmail dot com
Description:
------------
ctype_alnum returns false if you pass it an integer (ie 7). I know the
docs say that it should receive a string, as all ctype_* functions
should, but I believe it's pointless to have to do a ctype_alnum( '' .
$var ) at every call just to be sure. Also, the docs say that the
function is equivalent to preg_match('/^[a-z0-9]+$/iD', $text) and
matching 7 against that expression will work.
Reproduce code:
---------------
var_dump( ctype_alnum( 7 ) );
Expected result:
----------------
bool(true)
Actual result:
--------------
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42007&edit=1