mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 09:23:28 +01:00
fix wrong namespaced Exception: \DateTime throws \Exception
This commit is contained in:
parent
601ce45c4d
commit
0d432dcaab
@ -39,7 +39,7 @@ use DateInterval;
|
|||||||
* keys: ('year', 'month', 'day') or 'full' plus 'hour', 'minute' and optional 'second' or a DateTime object as parameter.
|
* keys: ('year', 'month', 'day') or 'full' plus 'hour', 'minute' and optional 'second' or a DateTime object as parameter.
|
||||||
* It defaults to user-time, not server time as DateTime!
|
* It defaults to user-time, not server time as DateTime!
|
||||||
*
|
*
|
||||||
* The constructor itself throws an Exception in that case (to be precise it does not handle the one thrown by DateTime constructor).
|
* The constructor itself throws an \Exception in that case (to be precise it does not handle the one thrown by DateTime constructor).
|
||||||
* Static methods server2user, user2server and to return NULL, if given time could not be parsed.
|
* Static methods server2user, user2server and to return NULL, if given time could not be parsed.
|
||||||
*
|
*
|
||||||
* @link http://www.php.net/manual/en/class.datetime.php
|
* @link http://www.php.net/manual/en/class.datetime.php
|
||||||
@ -469,7 +469,7 @@ class DateTime extends \DateTime
|
|||||||
{
|
{
|
||||||
$time = new DateTime($time);
|
$time = new DateTime($time);
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
catch(\Exception $e)
|
||||||
{
|
{
|
||||||
unset($e);
|
unset($e);
|
||||||
return null; // time could not be parsed
|
return null; // time could not be parsed
|
||||||
@ -546,12 +546,12 @@ class DateTime extends \DateTime
|
|||||||
try {
|
try {
|
||||||
self::$server_timezone = new DateTimeZone($GLOBALS['egw_info']['server']['server_timezone']);
|
self::$server_timezone = new DateTimeZone($GLOBALS['egw_info']['server']['server_timezone']);
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
catch(\Exception $e)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
self::$server_timezone = new DateTimeZone(date_default_timezone_get());
|
self::$server_timezone = new DateTimeZone(date_default_timezone_get());
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
catch(\Exception $e)
|
||||||
{
|
{
|
||||||
self::$server_timezone = new DateTimeZone('Europe/Berlin');
|
self::$server_timezone = new DateTimeZone('Europe/Berlin');
|
||||||
}
|
}
|
||||||
@ -706,7 +706,7 @@ if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE_
|
|||||||
echo "<p>DateTime($ts)->format('Y-m-d H:i:s')=".$et->format('Y-m-d H:i:s')."</p>\n";
|
echo "<p>DateTime($ts)->format('Y-m-d H:i:s')=".$et->format('Y-m-d H:i:s')."</p>\n";
|
||||||
$dt = new DateTime($ts);
|
$dt = new DateTime($ts);
|
||||||
echo "<p>DateTime($ts)->format('Y-m-d H:i:s')=".$dt->format('Y-m-d H:i:s')."</p>\n";
|
echo "<p>DateTime($ts)->format('Y-m-d H:i:s')=".$dt->format('Y-m-d H:i:s')."</p>\n";
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
echo "<p><b>Exception</b>: ".$e->getMessage()."</p>\n";
|
echo "<p><b>Exception</b>: ".$e->getMessage()."</p>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user