mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Handle empty (NULL) stmt in ast_export
This commit is contained in:
parent
9ee52ca3ae
commit
d8a6130660
2 changed files with 15 additions and 0 deletions
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…
Add table
Add a link
Reference in a new issue