From: Andrei Shevchuk Date: Sun, 20 Nov 2011 11:18:57 +0000 (+0400) Subject: php warning fix X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=c7a06cbbfe6badeb42d2ace2e83fee64da22b5c3;p=konrad%2Ftwig.git php warning fix --- 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 {