@@ -86,12 +86,10 @@ public static function reset(): void
8686 uopz_unset_return ('gettimeofday ' );
8787 uopz_unset_return ('gmdate ' );
8888 uopz_unset_return ('gmmktime ' );
89- uopz_unset_return ('gmstrftime ' );
9089 uopz_unset_return ('idate ' );
9190 uopz_unset_return ('localtime ' );
9291 uopz_unset_return ('microtime ' );
9392 uopz_unset_return ('mktime ' );
94- uopz_unset_return ('strftime ' );
9593 uopz_unset_return ('strtotime ' );
9694 uopz_unset_return ('time ' );
9795 uopz_unset_return (\DateTime::class, 'createFromFormat ' );
@@ -101,6 +99,14 @@ public static function reset(): void
10199 uopz_unset_return ('unixtojd ' );
102100 }
103101
102+ // The following two are deprecated -- prepare for removal in PHP 9.0
103+ if (function_exists ('gmstrftime ' )) {
104+ uopz_unset_return ('gmstrftime ' );
105+ }
106+ if (function_exists ('strftime ' )) {
107+ uopz_unset_return ('strftime ' );
108+ }
109+
104110 uopz_unset_mock (\DateTime::class);
105111 uopz_unset_mock (\DateTimeImmutable::class);
106112
@@ -123,19 +129,25 @@ private static function activateMocksIfNeeded(): void
123129 uopz_set_return ('gettimeofday ' , self ::mock_gettimeofday (), true );
124130 uopz_set_return ('gmdate ' , self ::mock_gmdate (), true );
125131 uopz_set_return ('gmmktime ' , self ::mock_gmmktime (), true );
126- uopz_set_return ('gmstrftime ' , self ::mock_gmstrftime (), true );
127132 uopz_set_return ('idate ' , self ::mock_idate (), true );
128133 uopz_set_return ('localtime ' , self ::mock_localtime (), true );
129134 uopz_set_return ('microtime ' , self ::mock_microtime (), true );
130135 uopz_set_return ('mktime ' , self ::mock_mktime (), true );
131- uopz_set_return ('strftime ' , self ::mock_strftime (), true );
132136 uopz_set_return ('strtotime ' , self ::mock_strtotime (), true );
133137 uopz_set_return ('time ' , self ::mock_time (), true );
134138
135139 if (extension_loaded ('calendar ' )) {
136140 uopz_set_return ('unixtojd ' , self ::mock_unixtojd (), true );
137141 }
138142
143+ // The following two are deprecated -- prepare for removal in PHP 9.0
144+ if (function_exists ('gmstrftime ' )) {
145+ uopz_set_return ('gmstrftime ' , self ::mock_gmstrftime (), true );
146+ }
147+ if (function_exists ('strftime ' )) {
148+ uopz_set_return ('strftime ' , self ::mock_strftime (), true );
149+ }
150+
139151 uopz_set_mock (\DateTime::class, DateTimeMock::class);
140152 uopz_set_return (\DateTime::class, 'createFromFormat ' , self ::mock_date_create_from_format (), true );
141153 uopz_set_mock (\DateTimeImmutable::class, DateTimeImmutableMock::class);
0 commit comments