Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By murrow on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.4.x
Introduced in version:
8.4.0
Issue links:
Description:
Before Drupal 8.4, the data structure returned was an array which held translatable markup objects:
system_time_zones();
Produces:
["Pacific/Tongatapu"]=>
object(Drupal\Core\StringTranslation\TranslatableMarkup)#4682 (5) {
["string":protected]=>
string(5) "@zone"
["translatedMarkup":protected]=>
NULL
["options":protected]=>
array(0) {
}
["stringTranslation":protected]=>
NULL
["arguments":protected]=>
array(1) {
["@zone"]=>
object(Drupal\Core\StringTranslation\TranslatableMarkup)#4681 (5) {
["string":protected]=>
string(17) "Pacific/Tongatapu"
["translatedMarkup":protected]=>
NULL
["options":protected]=>
array(0) {
}
["stringTranslation":protected]=>
NULL
["arguments":protected]=>
array(0) {
}
}
}
}
After Drupal 8.4, there is an optional override that forces the function to return a nested array structure:
system_time_zones(NULL, TRUE);
["Pacific"]=>
array(39) {
["Pacific/Apia"]=>
string(4) "Apia"
["Pacific/Auckland"]=>
string(8) "Auckland"
...
["Pacific/Tarawa"]=>
string(6) "Tarawa"
["Pacific/Tongatapu"]=>
string(9) "Tongatapu"
["Pacific/Wake"]=>
string(4) "Wake"
["Pacific/Wallis"]=>
string(6) "Wallis"
}
This is now the default for installation, administration regional settings and user profile timezone selection.
Impacts:
Site builders, administrators, editors
Module developers