Skip to content

Commit

Permalink
Fixed issue: Internal server error in token list
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Jun 14, 2016
1 parent 573d104 commit 2d3ff52
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions application/helpers/common_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -5347,8 +5347,14 @@ function convertDateTimeFormat($value, $fromdateformat, $todateformat)
*/
function convertToGlobalSettingFormat($sDate)
{

try
{
// Workaround for bug in older PHP version (confirmed for 5.5.9)
// The bug is causing invalid dates to create an internal server error which cannot not be caught by try.. catch
if (@strtotime($sDate) === false) {
throw new Exception("Failed to parse date string ({$sDate})");
}
$oDate = new DateTime($sDate); // We generate the Date object (PHP will deal with the format of the string)
$sDateformatdata = getDateFormatData(Yii::app()->session['dateformat']); // We get the Global Setting date format
$sDate = $oDate->format($sDateformatdata['phpdate']); // We apply it to the Date object to generate a string date
Expand Down

0 comments on commit 2d3ff52

Please sign in to comment.