fixed crash in twig_template_get_attributes when input is not an array or object

This commit is contained in:
Arnaud Le Blanc
2011-12-15 20:54:24 +01:00
parent fba7f95bd2
commit 9e6f285362
2 changed files with 23 additions and 4 deletions
+8 -1
View File
@@ -816,7 +816,14 @@ PHP_FUNCTION(twig_template_get_attributes)
if (ignoreStrictCheck || !TWIG_CALL_BOOLEAN(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "isStrictVariables" TSRMLS_CC) TSRMLS_CC) {
RETURN_FALSE;
}
TWIG_THROW_EXCEPTION("Twig_Error_Runtime" TSRMLS_CC, "Item \"%s\" for \"%s\" does not exist", item, TWIG_IMPLODE_ARRAY_KEYS(", ", object TSRMLS_CC));
if (Z_TYPE_P(object) == IS_ARRAY) {
TWIG_THROW_EXCEPTION("Twig_Error_Runtime" TSRMLS_CC, "Item \"%s\" for \"Array\" does not exist", item);
} else {
Z_ADDREF_P(object);
convert_to_string_ex(&object);
TWIG_THROW_EXCEPTION("Twig_Error_Runtime" TSRMLS_CC, "Item \"%s\" for \"%s\" does not exist", item, Z_STRVAL_P(object));
zval_ptr_dtor(&object);
}
return;
}
/*