Doc #79111 [NEW]: is_numeric documentation utterly incomplete
| From: | php4fan at gmail dot com | Date: | Mon, 13 Jan 2020 16:07:00 +0000 |
| Subject: | Doc #79111 [NEW]: is_numeric documentation utterly incomplete | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-17198@lists.php.net to get a copy of this message | ||
From: php4fan at gmail dot com
Operating system: all
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:is_numeric documentation utterly incomplete
Description:
------------
---
From manual page: https://php.net/function.is-numeric
---
I found out to my surprise that is_numeric(" 3") returns true, but
is_numeric("3 ") returns false. Spaces at the beginning of a string have
no effect; spaces at the end do, making the string not numeric.
Assuming that's the expected behavior, that's far from obvious and
should be documented.
The docs say:
"Numeric strings consist of optional sign, any number of digits,
optional decimal part and optional exponential part."
There's no mention whatsoever of spaces. From that description, taken
literally, I'd expect a space at the beginning to ALSO be considered
non-numeric. Short of that, I'd expect spaces to be either ignored both
at the beginning and end or neither.
Test script:
---------------
echo is_numeric("3")?"Yes\n":"no\n";
echo is_numeric(" 3")?"Yes\n":"no\n";
echo is_numeric("3 ")?"Yes\n":"no\n";
Expected result:
----------------
documentation should be exhaustive
Actual result:
--------------
documentation doesn't document the behavior properly.
--
Edit bug report at https://bugs.php.net/bug.php?id=79111&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79111&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79111&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79111&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79111&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79111&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79111&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79111&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79111&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79111&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79111&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79111&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79111&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79111&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79111&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79111&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79111&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79111&r=mysqlcfg