Doc #80624 [NEW]: Undocumented change php 8 vs php 7 abs function
From: ilyes dot ahidar at gmail dot com
Operating system: Linux Fedora 33
PHP version: 8.0.1
Package: *Math Functions
Bug Type: Documentation Problem
Bug description:Undocumented change php 8 vs php 7 abs function
Description:
------------
---
From manual page: https://php.net/function.abs
---
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:
---------------
<?php
declare(strict_types=1);
$a = "0.00";
var_dump(abs($a));
Expected result:
----------------
In php 7 it would output:
float(0)
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
--
Edit bug report at https://bugs.php.net/bug.php?id=80624&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80624&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80624&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80624&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80624&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80624&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80624&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80624&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80624&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80624&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80624&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80624&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80624&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80624&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80624&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80624&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80624&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80624&r=mysqlcfg
Thread (11 messages)
- ilyes dot ahidar at gmail dot com
- cmb@php.netDoc #80624 [Opn->Ver]: Undocumented change php 8 vs php 7 abs function
- cmb@php.netDoc #80624 [PATCH]: Undocumented change php 8 vs php 7 abs function
- lauramiller199846 at gmail dot comDoc #80624 [Com]: Undocumented change php 8 vs php 7 abs function
- mkshastriji77 at gmail dot comDoc #80624 [Com]: Undocumented change php 8 vs php 7 abs function
- donaldmontgo82 at gmail dot comDoc #80624 [Com]: Undocumented change php 8 vs php 7 abs function
- cmb@php.netDoc #80624 [Ver->Csd]: Undocumented change php 8 vs php 7 abs function
- kawewong at gmail dot comDoc #80624 [Com]: Undocumented change php 8 vs php 7 abs function
- cmb@php.netDoc #80624 [Csd]: Undocumented change php 8 vs php 7 abs function
- post at andreas-mause dot deDoc #80624 [Com]: Undocumented change php 8 vs php 7 abs function
- cmb@php.netDoc #80624 [Csd]: Undocumented change php 8 vs php 7 abs function