{"record":{"id":"e77ec2f08c14af5f","repo":"phacility/phabricator","slug":"timezone-s-is-not-a-valid-timezone-identifier","errorCode":null,"errorMessage":"Timezone \"%s\" is not a valid timezone identifier.","messagePattern":"Timezone \"(.+?)\" is not a valid timezone identifier\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"warning","filePath":"src/applications/settings/setting/PhabricatorTimezoneSetting.php","lineNumber":47,"sourceCode":"    // NOTE: This isn't doing anything fancy, it's just a much faster\n    // validator than doing all the timezone calculations to build the full\n    // list of options.\n\n    if (!$value) {\n      return;\n    }\n\n    static $identifiers;\n    if ($identifiers === null) {\n      $identifiers = DateTimeZone::listIdentifiers();\n      $identifiers = array_fuse($identifiers);\n    }\n\n    if (isset($identifiers[$value])) {\n      return;\n    }\n\n    throw new Exception(\n      pht(\n        'Timezone \"%s\" is not a valid timezone identifier.',\n        $value));\n  }\n\n  protected function getSelectOptionGroups() {\n    $timezones = DateTimeZone::listIdentifiers();\n    $now = new DateTime('@'.PhabricatorTime::getNow());\n\n    $groups = array();\n    foreach ($timezones as $timezone) {\n      $zone = new DateTimeZone($timezone);\n      $offset = ($zone->getOffset($now) / 60);\n      $groups[$offset][] = $timezone;\n    }\n\n    ksort($groups);\n","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/settings/setting/PhabricatorTimezoneSetting.php#L29-L65","documentation":"The timezone setting validates the submitted value against DateTimeZone::listIdentifiers() (the IANA tz database bundled with PHP), cached in a static per request. Any value not in that list - abbreviations like EST/PDT, offsets like UTC+2, misspellings, Windows zone names, or identifiers from a different tzdata version than the server's - throws this exception.","triggerScenarios":"Posting settings/timezone with 'EST', 'PDT', 'GMT+2', 'Pacific Standard Time' (Windows name), 'America/Los_Angeles' (typo), or a recently added IANA zone unknown to the server's older timezonedb.","commonSituations":"API/Conduit clients sending offsets or abbreviations; free-text inputs instead of the dropdown; PHP built with an outdated timezonedb extension rejecting newer zone names.","solutions":["Use exact IANA identifiers: 'America/Los_Angeles', 'Europe/Berlin', 'UTC'","Source the value from the settings dropdown - it is generated from the same listIdentifiers() call","Update PHP's timezonedb (e.g. PECL timezonedb) if a genuinely valid new zone is rejected","Never send abbreviations, offsets, or Windows timezone display names"],"exampleFix":"// before\n\"PST8PDT\"\n// or \"UTC-8\"\n\n// after\n\"America/Los_Angeles\"","handlingStrategy":"validation","validationCode":"$valid = array_fuse(DateTimeZone::listIdentifiers());\nif (!isset($valid[$value])) {\n  // reject before posting: use an exact IANA identifier\n}","typeGuard":"function isValidTimezoneIdentifier($tz) {\n  return is_string($tz) && in_array($tz, DateTimeZone::listIdentifiers(), true);\n}","tryCatchPattern":null,"preventionTips":["Offer the generated timezone dropdown; never free-text input","Default to 'UTC' when unsure","Keep PHP's timezonedb extension current on both web and CLI hosts","Never send abbreviations (EST), offsets (UTC+2), or Windows zone names"],"tags":["settings","timezone","validation","php","iana-tzdata"],"backgroundTag":"invalid-timezone-identifier","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}