Bug #77072 [NEW]: DateInterval constructor should provide a way to construct a negative interval

From: Date: Sat, 27 Oct 2018 17:24:01 +0000
Subject: Bug #77072 [NEW]: DateInterval constructor should provide a way to construct a negative interval
Groups: php.standards 
Request: Send a blank email to standards-+get-1338@lists.php.net to get a copy of this message
From: teo8976 at gmail dot com Operating system: all PHP version: 7.3.0RC4 Package: PHP Language Specification Bug Type: Bug Bug description:DateInterval constructor should provide a way to construct a negative interval Description: ------------ A DateInterval object can represent negative intervals, when its $invert property equals 1. However, there's no way (or no documented way) to construct a DateInterval object that is inverted with the constructor. Yoy need to do: $interval = new DateInterval("whatever"); $interval->inverted = 1; It's absolutely ridiculous and pathetic that there exist values that can be represented by the class but cannot be created with the constructor. The interval_spec should support a way to specify inverted intervals. Any of these would be fine, it's just a matter of taste: - prefix the interval with a "-" (minus) sign e.g. "-P1Y3D" - a "-" (minus) sign after the initial P e.g. "P-1Y3D" - some suffix at the end, for example "I" for "Inverted" e.g. "P1Y3DN" -- Edit bug report at https://bugs.php.net/bug.php?id=77072&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77072&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77072&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77072&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77072&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77072&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77072&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77072&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77072&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77072&r=support Expected behavior: https://bugs.php.net/fix.php?id=77072&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77072&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77072&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77072&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77072&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77072&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77072&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77072&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77072&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77072&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77072&r=mysqlcfg

« previous php.standards (#1338) next »