Bug #76945 [NEW]: DateTime modify with decimals
| From: | wijnand at samson-it dot nl | Date: | Fri, 28 Sep 2018 11:43:49 +0000 |
| Subject: | Bug #76945 [NEW]: DateTime modify with decimals | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-217265@lists.php.net to get a copy of this message | ||
From: wijnand at samson-it dot nl
Operating system:
PHP version: 7.2.10
Package: Date/time related
Bug Type: Bug
Bug description:DateTime modify with decimals
Description:
------------
---
From manual page: http://www.php.net/datetime.modify
---
Let's modify a DateTime object, say "add one-and-a-half hour". The
expected result is that 1 hour and 30 minutes are added. The actual
result is that 5 hours are added.
It's not necessarily a problem that the decimal syntax is not supported,
however there's no warning that this doesn't work. It's not documented
and the call is happily accepted. I would say that the regex should be
"\+\d+" or something along those lines.
Test script:
---------------
(new DateTime('2000-01-01 0:00'))->modify('+1.5 hours');
--
Edit bug report at https://bugs.php.net/bug.php?id=76945&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76945&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76945&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76945&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76945&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76945&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76945&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76945&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76945&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76945&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76945&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76945&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76945&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76945&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76945&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76945&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76945&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76945&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76945&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76945&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76945&r=mysqlcfg