Doc #80624 [NEW]: Undocumented change php 8 vs php 7 abs function

From: Date: Thu, 14 Jan 2021 16:21:37 +0000
Subject: Doc #80624 [NEW]: Undocumented change php 8 vs php 7 abs function
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18389@lists.php.net to get a copy of this message
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)

« previous php.doc.bugs (#18389) next »