projects
/
konrad/twig.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
e1663e8
)
Implemented TWIG_RETURN_ARRAY_ELEMENT.
author
Derick Rethans
<github@derickrethans.nl>
Thu, 30 Jun 2011 10:25:57 +0000 (11:25 +0100)
committer
Derick Rethans
<github@derickrethans.nl>
Thu, 30 Jun 2011 10:25:57 +0000 (11:25 +0100)
twig.c
patch
|
blob
|
history
diff --git
a/twig.c
b/twig.c
index
a072ca3
..
f365ab7
100644
(file)
--- a/
twig.c
+++ b/
twig.c
@@
-154,9
+154,18
@@
int TWIG_ISSET_ARRAY_ELEMENT(zval *array, zval *item)
return 0;
}
-zval *TWIG_RETURN_ARRAY_ELEMENT(zval *object, zval *item)
+zval *TWIG_RETURN_ARRAY_ELEMENT(zval *array, zval *key)
{
+ void *dummy;
+ if (Z_TYPE_P(array) != IS_ARRAY) {
+ return NULL;
+ }
+ convert_to_string(key);
+ if (zend_hash_find(Z_ARRVAL_P(array), Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &dummy) == SUCCESS) {
+ return dummy;
+ }
+ return NULL;
}
zval *TWIG_PROPERTY(zval *object, char *propname)