projects
/
web/konrad/twig.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
f742efd
)
Date filter should treat strict integers as Unix timestamps (same as all-digit strings)
author
Jeremy Mikola
<jmikola@gmail.com>
Fri, 27 May 2011 18:54:06 +0000 (11:54 -0700)
committer
Jeremy Mikola
<jmikola@gmail.com>
Fri, 27 May 2011 18:54:06 +0000 (11:54 -0700)
Without a string cast, ctype_digit() will return false for an integer.
lib/Twig/Extension/Core.php
patch
|
blob
|
history
diff --git
a/lib/Twig/Extension/Core.php
b/lib/Twig/Extension/Core.php
index
07ceea0
..
61429d8
100644
(file)
--- a/
lib/Twig/Extension/Core.php
+++ b/
lib/Twig/Extension/Core.php
@@
-203,7
+203,7
@@
class Twig_Extension_Core extends Twig_Extension
function twig_date_format_filter($date, $format = 'F j, Y H:i')
{
if (!$date instanceof DateTime) {
- $date = new DateTime((ctype_digit($date) ? '@' : '').$date);
+ $date = new DateTime((ctype_digit((string) $date) ? '@' : '').$date);
}
return $date->format($format);