Permalink
Browse files

fixed a regression introduced by aa6b835

  • Loading branch information...
1 parent c35e16d commit 8ec73cf4759f90b961de1732da1732e60c1dbfff @fabpot committed May 16, 2012
View
@@ -1,6 +1,6 @@
-* 1.9.0 (2012-XX-XX)
+* 1.8.1 (2012-XX-XX)
- * n/a
+ * fixed a regression when dealing with SimpleXMLElement instances in templates
* 1.8.0 (2012-05-08)
View
@@ -25,7 +25,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "1.9-dev"
+ "dev-master": "1.8-dev"
}
}
}
View
@@ -15,7 +15,7 @@
#ifndef PHP_TWIG_H
#define PHP_TWIG_H
-#define PHP_TWIG_VERSION "1.9.0-DEV"
+#define PHP_TWIG_VERSION "1.8.1-DEV"
#include "php.h"
View
@@ -17,7 +17,7 @@
*/
class Twig_Environment
{
- const VERSION = '1.9.0-DEV';
+ const VERSION = '1.8.1-DEV';
protected $charset;
protected $loader;
View
@@ -326,7 +326,7 @@ protected function displayWithErrorHandling(array $context, array $blocks = arra
*/
protected function getAttribute($object, $item, array $arguments = array(), $type = Twig_TemplateInterface::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false)
{
- $item = (string) $item;
+ $item = is_numeric($item) ? (int) $item : (string) $item;
// array
if (Twig_TemplateInterface::METHOD_CALL !== $type) {
@@ -0,0 +1,15 @@
+--TEST--
+Twig is able to deal with SimpleXMLElement instances as variables
+--TEMPLATE--
+Hello '{{ images.image.0.group }}'!
+{{ images.children().count() }}
+{% for image in images %}
+ - {{ image.group }}
+{% endfor %}
+--DATA--
+return array('images' => new SimpleXMLElement('<images><image><group>foo</group></image><image><group>bar</group></image></images>'))
+--EXPECT--
+Hello 'foo'!
+2
+ - foo
+ - bar

0 comments on commit 8ec73cf

Please sign in to comment.