diff options
Diffstat (limited to 'ext/date/tests/bug73858.phpt')
-rw-r--r-- | ext/date/tests/bug73858.phpt | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/date/tests/bug73858.phpt b/ext/date/tests/bug73858.phpt index fb41390b0f..b6074ff01a 100644 --- a/ext/date/tests/bug73858.phpt +++ b/ext/date/tests/bug73858.phpt @@ -15,8 +15,8 @@ $e = new DateTime($es); $d= $e->diff($s); var_dump($d->days); // 0 ... but should be 30 -$s = (new DateTime(null))->setTimestamp(strtotime($ss)); // verbose setup method -$e = (new DateTime(null))->setTimestamp(strtotime($es)); // verbose setup method +$s = (new DateTime("now"))->setTimestamp(strtotime($ss)); // verbose setup method +$e = (new DateTime("now"))->setTimestamp(strtotime($es)); // verbose setup method $d = $e->diff($s); var_dump($d->days); // 30 ... and should be 30 @@ -24,13 +24,13 @@ var_dump($d->days); // 30 ... and should be 30 Next we will try mix/match the code to see what happens, surprisingly it seems that the end date ($e) is the important one, if it uses the verbose method it returns the correct values. */ -$s = (new DateTime(null))->setTimestamp(strtotime($ss)); // verbose setup method +$s = (new DateTime("now"))->setTimestamp(strtotime($ss)); // verbose setup method $e = new DateTime($es); $d= $e->diff($s); var_dump($d->days); // 0 ... but should be 30 $s = new DateTime($ss); -$e = (new DateTime(null))->setTimestamp(strtotime($es)); // verbose setup method +$e = (new DateTime("now"))->setTimestamp(strtotime($es)); // verbose setup method $d= $e->diff($s); var_dump($d->days); // 30 ... and should be 30 @@ -39,7 +39,7 @@ This test just proves that the $e date is important BUT NOT because it's the one on, that's just coincidental that seems to imply that the "- 1 second" in the date string is the problem. */ $s = new DateTime($ss); -$e = (new DateTime(null))->setTimestamp(strtotime($es)); // verbose setup method +$e = (new DateTime("now"))->setTimestamp(strtotime($es)); // verbose setup method $d= $s->diff($e); var_dump($d->days); // 30 ... and should be 30 |