From c854bb2472c18764a155be0de07eae2e63d2cce9 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Fri, 22 Apr 2022 10:29:35 +0100 Subject: [PATCH] Fixed GH-8400: bug73837.phpt makes no sense Replaces the indeed silly test with something that actually does the job, albeit much slower. --- ext/date/tests/bug73837.phpt | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/ext/date/tests/bug73837.phpt b/ext/date/tests/bug73837.phpt index c11aa2c56bfa7..33b2afb898670 100644 --- a/ext/date/tests/bug73837.phpt +++ b/ext/date/tests/bug73837.phpt @@ -1,19 +1,23 @@ --TEST-- Bug #73837: Milliseconds in DateTime() +--SKIPIF-- + --FILE-- format( "u" ); - $collect[$key] = true; +$startTS = time(); +$prev_dt = new DateTime(); +while (time() < $startTS + 2) { + $dt = new DateTime(); + if ($prev_dt > $dt) { + var_dump($prev_dt->format("Y-m-d H:i:s.u")); + var_dump($dt->format("Y-m-d H:i:s.u")); + break; + } + $prev_dt = $dt; } - -var_dump($n = count( $collect )); -echo ( $n > 700 ) ? "microseconds differ\n" : "microseconds do not differ enough ($n)\n"; +echo "Finished\n"; ?> --EXPECTF-- -int(%d) -microseconds differ +Finished