1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00

prevent Exception: DateTimeZone

This commit is contained in:
DanielnetoDotCom 2020-12-08 12:34:12 -03:00
parent a382ee6417
commit 6f8335f61a

View file

@ -52,9 +52,17 @@ abstract class ObjectYPT implements ObjectInterface {
if(empty($timeZOnesOptions[$advancedCustom->timeZone->value])){
return false;
}
$dt->setTimezone(new DateTimeZone($timeZOnesOptions[$advancedCustom->timeZone->value]));
date_default_timezone_set($timeZOnesOptions[$advancedCustom->timeZone->value]);
return $dt;
try {
$objDate = new DateTimeZone($timeZOnesOptions[$advancedCustom->timeZone->value]);
if(is_object($objDate)){
$dt->setTimezone($objDate);
date_default_timezone_set($timeZOnesOptions[$advancedCustom->timeZone->value]);
return $dt;
}
return false;
} catch (Exception $exc) {
return false;
}
}
static protected function getFromDb($id) {