Skip to content

Fix flaky timezone test fixture (GH-18624)#21665

Open
hakre wants to merge 1 commit intophp:masterfrom
hakre:patch-20028-8.3-ext-date
Open

Fix flaky timezone test fixture (GH-18624)#21665
hakre wants to merge 1 commit intophp:masterfrom
hakre:patch-20028-8.3-ext-date

Conversation

@hakre
Copy link
Copy Markdown
Contributor

@hakre hakre commented Apr 7, 2026

As documented in RunningTests, tests have to be written to be independent of any php.ini file.

Without specifying the timezone, the var_dump() will make use of the default timezone that may not be the expected "UTC" timezone.

This renders the test-cases flaky and will make them fail if the date.timezone is different from the string "UTC".

Fix is to interpolate the timezone in the test fixture or to set date.timezone to UTC.

fix-up-of: GH-18624

As documented in [RunningTests], tests have to be written to be
independent of any php.ini file.

Without specifying the timezone, the var_dump() will make use of the
default timezone that may not be the expected "UTC" timezone.

This renders the test-cases flaky and will make them fail if the
`date.timezone` is different from the string "UTC".

Fix is to interpolate the timezone in the test fixture or to set
`date.timezone` to `UTC`.

[RunningTests]: docs/source/miscellaneous/running-tests.rst
fix-up-of: phpGH-18624
@hakre
Copy link
Copy Markdown
Contributor Author

hakre commented Apr 7, 2026

@derickr This is the ext/date part from #20035, rebased. You had approved this previously – could you take another look? Thanks.

@iluuu1994
Copy link
Copy Markdown
Member

I see there's this:

php-src/run-tests.php

Lines 187 to 190 in d34c09f

// If timezone is not set, use UTC.
if (ini_get('date.timezone') == '') {
date_default_timezone_set('UTC');
}

But that's not effective for the processes spawned from run-tests.php. Maybe that should just be added to the $ini_overwrites array here:

$ini_overwrites = [

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants