Handle empty (NULL) stmt in ast_export

This commit is contained in:
nikita2206 2015-07-09 18:43:50 +04:00 committed by Nikita Popov
parent 9ee52ca3ae
commit d8a6130660
2 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,11 @@
--TEST--
Empty statement in assert() shouldn't segfault
--FILE--
<?php
assert((function () { return true;; })());
echo "ok";
?>
--EXPECT--
ok

View File

@ -783,6 +783,10 @@ static void zend_ast_export_var_list(smart_str *str, zend_ast_list *list, int in
static void zend_ast_export_stmt(smart_str *str, zend_ast *ast, int indent)
{
if (!ast) {
return;
}
if (ast->kind == ZEND_AST_STMT_LIST ||
ast->kind == ZEND_AST_TRAIT_ADAPTATIONS) {
zend_ast_list *list = (zend_ast_list*)ast;