Bug->Doc #80148 [Opn->Ver]: ctype_* functions silently return false for unsupported types
| From: | cmb@php.net | Date: | Fri, 25 Sep 2020 09:40:36 +0000 |
| Subject: | Bug->Doc #80148 [Opn->Ver]: ctype_* functions silently return false for unsupported types | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-17903@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80148&edit=1
ID: 80148
Updated by: cmb@php.net
Reported by: d dot penning at stroeermediabrands dot de
Summary: ctype_* functions silently return false for
unsupported types
-Status: Open
+Status: Verified
-Type: Bug
+Type: Documentation Problem
Package: Unknown/Other Function
PHP Version: 7.2.33
Block user comment: N
Private report: N
New Comment:
That's actually a documentation issue: there is special support
for int arguments:
<https://github.com/php/php-src/blob/php-7.3.22/ext/ctype/ctype.c#L150-L159>.
Previous Comments:
------------------------------------------------------------------------
[2020-09-25 09:27:42] d dot penning at stroeermediabrands dot de
Description:
------------
According to the documentation the ctype functions only accept strings as arguments. Passing any
type that is not supported only returns false and does not throw any warning or TypeError. Setting
declare(strict_types = 1); also has no effect on this.
Test script:
---------------
ctype_digit(1);
Expected result:
----------------
A warning or error hinting that an unsupported type was passed to a ctype function.
Actual result:
--------------
false
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80148&edit=1