mirror of
https://github.com/php/php-src.git
synced 2024-11-28 20:34:29 +08:00
Handle empty (NULL) stmt in ast_export
This commit is contained in:
parent
9ee52ca3ae
commit
d8a6130660
11
Zend/tests/assert/expect_empty_stmt_bug.phpt
Normal file
11
Zend/tests/assert/expect_empty_stmt_bug.phpt
Normal file
@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Empty statement in assert() shouldn't segfault
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
assert((function () { return true;; })());
|
||||
echo "ok";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user