Skip to content

Commit

Permalink
Those are array elements and not properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Jul 7, 2011
1 parent 9f6495f commit 1e726f4
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions twig.c
Expand Up @@ -690,24 +690,29 @@ PHP_FUNCTION(twig_template_get_attributes)
*/
{
char *lcItem = TWIG_STRTOLOWER_ZVAL(item);
int lcItem_length;
char *method = NULL;
char *tmp_method_name_get = emalloc(4 + strlen(lcItem));
char *tmp_method_name_is = emalloc(3 + strlen(lcItem));
char *tmp_method_name_get;
char *tmp_method_name_is;
zval *tmp_class, *tmp_methods;

lcItem_length = strlen(lcItem);
tmp_method_name_get = emalloc(4 + lcItem_length);
tmp_method_name_is = emalloc(3 + lcItem_length);

sprintf(tmp_method_name_get, "get%s", lcItem);
sprintf(tmp_method_name_is, "is%s", lcItem);

tmp_class = TWIG_GET_ARRAY_ELEMENT(tmp_self_cache, class_name, strlen(class_name));
tmp_methods = TWIG_GET_ARRAY_ELEMENT(tmp_class, "methods", sizeof("methods"));
tmp_methods = TWIG_GET_ARRAY_ELEMENT(tmp_class, "methods", strlen("methods"));

if (TWIG_PROPERTY(tmp_methods, lcItem)) {
if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, lcItem, lcItem_length)) {
method = Z_STRVAL_P(item);
} else if (TWIG_PROPERTY(tmp_methods, tmp_method_name_get)) {
} else if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, tmp_method_name_get, lcItem_length + 3)) {
method = tmp_method_name_get;
} else if (TWIG_PROPERTY(tmp_methods, tmp_method_name_is)) {
} else if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, tmp_method_name_is, lcItem_length + 2)) {
method = tmp_method_name_is;
} else if (TWIG_PROPERTY(tmp_methods, "__call")) {
} else if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, "__call", 6)) {
method = Z_STRVAL_P(item);
/*
} else {
Expand Down

0 comments on commit 1e726f4

Please sign in to comment.