diff --git a/e107_handlers/date_handler.php b/e107_handlers/date_handler.php index df0615bb2..0a6ef9b53 100644 --- a/e107_handlers/date_handler.php +++ b/e107_handlers/date_handler.php @@ -789,7 +789,7 @@ class e_date */ public function strptime($str, $format) { - if(function_exists('strptime')) // Unix Only. + if(STRPTIME_COMPAT !== TRUE && function_exists('strptime')) // Unix Only. { $vals = strptime($str,$format); // PHP5 is more accurate than below. $vals['tm_amon'] = strftime('%b', mktime(0,0,0, $vals['tm_mon'] +1) ); @@ -894,7 +894,7 @@ class e_date } - if($ampm) + if($ampm && isset($vals['tm_hour'])) { if($vals['tm_hour'] == 12 && ($vals['tm_AMPM'] == 'AM' || $vals['tm_ampm'] == 'am')) { diff --git a/e107_handlers/php_compatibility_handler.php b/e107_handlers/php_compatibility_handler.php index 4605398c0..e26abfe77 100644 --- a/e107_handlers/php_compatibility_handler.php +++ b/e107_handlers/php_compatibility_handler.php @@ -30,10 +30,13 @@ if (!defined('e107_INIT')) if (!function_exists('strptime')) { + + define('STRPTIME_COMPAT', true); function strptime($str, $format) { return e107::getDate()->strptime($str,$format); } + } //PHP < 5.2 compatibility