#39024 [Opn->Csd]: regex equivalent for ctype_alnum() is wrong
| From: | joey@php.net | Date: | Tue, 03 Oct 2006 11:03:59 +0000 |
| Subject: | #39024 [Opn->Csd]: regex equivalent for ctype_alnum() is wrong | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969374124@lists.php.net to get a copy of this message | ||
ID: 39024
Updated by: joey@php.net
Reported By: arpad@php.net
-Status: Open
+Status: Closed
Bug Type: Documentation problem
PHP Version: Irrelevant
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Fixed in CVS.
Previous Comments:
------------------------------------------------------------------------
[2006-10-03 10:56:34] arpad@php.net
Description:
------------
The manual page for ctype_alnum() -
http://www.php.net/manual/en/function.ctype-alnum.php
- states that
"the function is equivalent to preg_match('/^[a-z0-9]+$/i', $text).".
However $ matches a trailing newline as well as the end of the subject;
it should be replaced with \z which only matches the end of the subject.
Reproduce code:
---------------
$s = "abc\n";
var_dump(ctype_alnum($s), preg_match("/^[a-z0-9]+$/i", $s));
Expected result:
----------------
bool(false)
int(0)
Actual result:
--------------
bool(false)
int(1)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39024&edit=1