avoid crash when TWIG_GET_ARRAY_ELEMENT returns NULL
authorArnaud Le Blanc <arnaud.lb@gmail.com>
Mon, 20 Aug 2012 18:28:22 +0000 (20:28 +0200)
committerArnaud Le Blanc <arnaud.lb@gmail.com>
Mon, 20 Aug 2012 18:28:22 +0000 (20:28 +0200)
fixes #807

ext/twig/twig.c

index 2125592..498392d 100644 (file)
@@ -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);