1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 19:42:38 +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])){ if(empty($timeZOnesOptions[$advancedCustom->timeZone->value])){
return false; return false;
} }
$dt->setTimezone(new DateTimeZone($timeZOnesOptions[$advancedCustom->timeZone->value])); try {
date_default_timezone_set($timeZOnesOptions[$advancedCustom->timeZone->value]); $objDate = new DateTimeZone($timeZOnesOptions[$advancedCustom->timeZone->value]);
return $dt; 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) { static protected function getFromDb($id) {