Bug #81054 [NEW]: abs on string fatal error
| From: | alienmega at protonmail dot com | Date: | Wed, 19 May 2021 15:58:22 +0000 |
| Subject: | Bug #81054 [NEW]: abs on string fatal error | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-233899@lists.php.net to get a copy of this message | ||
From: alienmega at protonmail dot com
Operating system: Windows
PHP version: 8.0.6
Package: *Math Functions
Bug Type: Bug
Bug description:abs on string fatal error
Description:
------------
According to php.net
abs ( mixed $number ) : int|float
mixed is equivalent to the union type array|bool|callable|int|float
|object|resource|string|null . Available as of PHP 8.0.0.
So abs should take a string. Instead we get a fatal error
Fatal error: Uncaught TypeError: abs(): Argument #1 ($num) must be of
type int|float, string
Test script:
---------------
abs('');
Expected result:
----------------
0
Actual result:
--------------
Fatal error: Uncaught TypeError: abs(): Argument #1 ($num) must be of
type int|float, string
--
Edit bug report at https://bugs.php.net/bug.php?id=81054&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81054&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81054&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81054&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81054&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81054&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81054&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81054&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81054&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81054&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81054&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81054&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81054&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81054&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81054&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81054&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81054&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81054&r=mysqlcfg