From c7a06cbbfe6badeb42d2ace2e83fee64da22b5c3 Mon Sep 17 00:00:00 2001 From: Andrei Shevchuk Date: Sun, 20 Nov 2011 15:18:57 +0400 Subject: [PATCH] php warning fix --- lib/Twig/Extension/Core.php | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index 88f545b..c0ab8cb 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -238,9 +238,10 @@ function twig_date_format_filter($date, $format = 'F j, Y H:i', $timezone = null { if (!$date instanceof DateTime && !$date instanceof DateInterval) { if (ctype_digit((string) $date) - || (('-' == $date[0]) - && (ctype_digit(substr($date, 1)))) - ) { + || (!empty($date[0]) + && ('-' === $date[0]) + && ctype_digit(substr($date, 1))) + ) { $date = new DateTime('@'.$date); $date->setTimezone(new DateTimeZone(date_default_timezone_get())); } else { -- 1.7.2.5