From 3ca665461749e7b1f52b0b09ab592ceb38ff9479 Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Mon, 20 Aug 2012 20:28:22 +0200 Subject: [PATCH] avoid crash when TWIG_GET_ARRAY_ELEMENT returns NULL fixes #807 --- ext/twig/twig.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/twig/twig.c b/ext/twig/twig.c index 2125592f3..498392daf 100644 --- a/ext/twig/twig.c +++ b/ext/twig/twig.c @@ -713,6 +713,9 @@ PHP_FUNCTION(twig_template_get_attributes) } ret = TWIG_GET_ARRAY_ELEMENT(object, item, item_len TSRMLS_CC); + if (!ret) { + ret = &EG(uninitialized_zval); + } RETVAL_ZVAL(ret, 1, 0); if (free_ret) { zval_ptr_dtor(&ret);