Bug #81500 [NEW]: Interval serialization regression since 7.3.14 / 7.4.2
From: kylekatarnls at gmail dot com
Operating system:
PHP version: 8.0.11
Package: Date/time related
Bug Type: Bug
Bug description:Interval serialization regression since 7.3.14 / 7.4.2
Description:
------------
When DateInterval f property = -0.000001, it's properly restored as
float(-1.0E-6) after unserialize(serialize()) until PHP 7.3.13 / 7.4.1
but since 7.3.14 / 7.4.2 and all >= 8, it becomes int(-1)
See https://3v4l.org/t5N4d
Test script:
---------------
$interval = new DateInterval('PT1S');
$interval->f = -0.000001;
var_dump($interval->s, $interval->f);
echo "\n";
$interval = unserialize(serialize($interval));
var_dump($interval->s, $interval->f);
Expected result:
----------------
int(1)
float(-1.0E-6)
int(1)
float(-1.0E-6)
Actual result:
--------------
int(1)
float(-1.0E-6)
int(1)
int(-1)
--
Edit bug report at https://bugs.php.net/bug.php?id=81500&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81500&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81500&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81500&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81500&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81500&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81500&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81500&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81500&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81500&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81500&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81500&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81500&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81500&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81500&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81500&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81500&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81500&r=mysqlcfg
Thread (8 messages)
- kylekatarnls at gmail dot com