|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80624 Undocumented change php 8 vs php 7 abs function
Submitted: 2021-01-14 16:21 UTC Modified: 2021-01-14 16:53 UTC
From: ilyes dot ahidar at gmail dot com Assigned:
Status: Verified Package: *Math Functions
PHP Version: 8.0.1 OS: Linux Fedora 33
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: ilyes dot ahidar at gmail dot com
New email:
PHP Version: OS:


 [2021-01-14 16:21 UTC] ilyes dot ahidar at gmail dot com
From manual page:

The manual says that the abs() function accepts 1 argument of the type "mixed", but enabling strict_types and passing a string to the abs function outputs an type error.

Test script:


$a = "0.00";


Expected result:
In php 7 it would output:


Actual result:
Fatal error: Uncaught TypeError: abs(): Argument #1 ($num) must be of type int|float, string given in /in/ZD7Kd:7
Stack trace:
#0 /in/ZD7Kd(7): abs('0.00')
#1 {main}
  thrown in /in/ZD7Kd on line 7


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-01-14 16:53 UTC]
-Status: Open +Status: Verified
 [2021-01-14 16:54 UTC]
The following pull request has been associated:

Patch Name: Generate some standard methodsynopses based on stubs
On GitHub:
 [2021-01-25 10:27 UTC] donaldmontgo82 at gmail dot com
Thanks for Sharing....
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed May 12 06:01:23 2021 UTC