php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #39024 regex equivalent for ctype_alnum() is wrong
Submitted: 2006-10-03 10:56 UTC Modified: 2006-10-03 11:03 UTC
From: arpad@php.net Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2006-10-03 10:56 UTC] 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)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-03 11:03 UTC] joey@php.net
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.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 15:01:33 2025 UTC