From cdc4e49b84230c98a27b788db9a9530bea2b8d17 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 12 Aug 2020 17:06:02 +0200 Subject: [PATCH] Make strftime tests musl compatible * Remove usage of strftime() in favor of date() in cases where we are not specifically testing strftime(). We implement date() ourselves, and as such are insulated from implementation- defined behavior. * Add skipif for broken strftime() %Z support. We have decided not to work around the issue for musl using manual expansion, as people should not be using this function anyway, and it is slated for future deprecation. * Don't test strftime() with invalid format specifier. The behavior is implementation-dependent. --- ext/date/tests/009.phpt | 4 ---- ext/date/tests/bug27780.phpt | 7 +------ ext/date/tests/bug32555.phpt | 20 ++++++++------------ ext/date/tests/bug33532.phpt | 1 + ext/standard/tests/time/strptime_basic.phpt | 9 +++++---- ext/standard/tests/time/strptime_parts.phpt | 7 ++++--- 6 files changed, 19 insertions(+), 29 deletions(-) diff --git a/ext/date/tests/009.phpt b/ext/date/tests/009.phpt index 9d77a552cc..624b2d5f66 100644 --- a/ext/date/tests/009.phpt +++ b/ext/date/tests/009.phpt @@ -13,13 +13,11 @@ $t = mktime(0,0,0, 6, 27, 2006); var_dump(strftime("")); var_dump(strftime("%a %A %b %B %c %C %d %D %e %g %G %h %H %I %j %m %M %n %p %r %R %S %t %T %u %U %V %W %w %x %X %y %Y %Z %z %%", $t)); var_dump(strftime("%%q %%a", $t)); -var_dump(strftime("%q", $t)); var_dump(strftime("blah", $t)); var_dump(gmstrftime("")); var_dump(gmstrftime("%a %A %b %B %c %C %d %D %e %g %G %h %H %I %j %m %M %n %p %r %R %S %t %T %u %U %V %W %w %x %X %y %Y %Z %z %%", $t)); var_dump(gmstrftime("%%q %%a", $t)); -var_dump(gmstrftime("%q", $t)); var_dump(gmstrftime("blah", $t)); echo "Done\n"; @@ -29,12 +27,10 @@ bool(false) string(%d) "Tue Tuesday Jun June Tue Jun 27 00:00:00 2006 %s %s %" string(5) "%q %a" -string(%d) "%s" string(4) "blah" bool(false) string(%d) "Mon Monday Jun June Mon Jun 26 21:00:00 2006 %s %s %" string(5) "%q %a" -string(%d) "%s" string(4) "blah" Done diff --git a/ext/date/tests/bug27780.phpt b/ext/date/tests/bug27780.phpt index f6f21e4185..52387b08bb 100644 --- a/ext/date/tests/bug27780.phpt +++ b/ext/date/tests/bug27780.phpt @@ -1,10 +1,5 @@ --TEST-- Bug #27780 (strtotime(+1 xxx) returns a wrong date/time) ---SKIPIF-- - --INI-- date.timezone=US/Eastern --FILE-- --EXPECT-- -Sat Apr 2 02:30:00 2005 EST -Sun Apr 3 00:00:00 2005 EST -Sun Apr 3 03:30:00 2005 EDT -Mon Apr 4 02:30:00 2005 EDT +Sat, 02 Apr 2005 02:30:00 -0500 +Sun, 03 Apr 2005 00:00:00 -0500 +Sun, 03 Apr 2005 03:30:00 -0400 +Mon, 04 Apr 2005 02:30:00 -0400 diff --git a/ext/date/tests/bug33532.phpt b/ext/date/tests/bug33532.phpt index 5323e8c8db..80b87f7e6d 100644 --- a/ext/date/tests/bug33532.phpt +++ b/ext/date/tests/bug33532.phpt @@ -6,6 +6,7 @@ date.timezone=UTC --SKIPIF-- --FILE-- --FILE-- --FILE--