Bug #81106 [NEW]: Regression in 8.1: add() now truncate ->f

From: Date: Fri, 04 Jun 2021 17:41:46 +0000
Subject: Bug #81106 [NEW]: Regression in 8.1: add() now truncate ->f
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234213@lists.php.net to get a copy of this message
From: kylekatarnls at gmail dot com Operating system: Ubuntu PHP version: master-Git-2021-06-04 (Git) Package: Date/time related Bug Type: Bug Bug description:Regression in 8.1: add() now truncate ->f Description: ------------ An interval with ->f = 1.234 was previously understood as 1.234 second when using in DateTime::add() which sounds pretty consistent. Now it's understood as 0.234 which feels pretty unsafe. Moreover, if we dump the interval, we see ->f value is still 1.234. If ->f can now longer be >= 1, it would rather need to throw an exception rather than accepting it and be interpreted differently regarding where it's used. Test script: --------------- $dateInterval = new DateInterval('PT0S'); $dateInterval->f = 1.234; echo (new DateTimeImmutable('2000-01-01 00:00:00'))->add($dateInterval)->format('Y-m-d H:i:s.u'); Expected result: ---------------- 2000-01-01 00:00:01.234000 (What we got for PHP <= 8.0) Actual result: -------------- 2000-01-01 00:00:00.234000 (What we get now with master branch) -- Edit bug report at https://bugs.php.net/bug.php?id=81106&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81106&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81106&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81106&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81106&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81106&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81106&r=support Expected behavior: https://bugs.php.net/fix.php?id=81106&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81106&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81106&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81106&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81106&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81106&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81106&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81106&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81106&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81106&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81106&r=mysqlcfg

« previous php.bugs (#234213) next »