From 78492f64568beb96b8ba8603fae41f340ae28c53 Mon Sep 17 00:00:00 2001 From: i582 Date: Sun, 7 Feb 2021 07:52:29 +0300 Subject: [PATCH] internal: fixed parsing of anonymous classes Since now 'ctor_arguments' returns nil, it is necessary to initialize it to avoid panics. --- internal/php7/php7.go | Bin 221304 -> 221381 bytes internal/php7/php7.y | 4 ++++ 2 files changed, 4 insertions(+) diff --git a/internal/php7/php7.go b/internal/php7/php7.go index 18eef9db06ae845f433144ec831cbd898dc7b982..c7a41b4149ba1c4ba5ce847851ca4369bd1b201b 100644 GIT binary patch delta 90 zcmV-g0Hy!uX38&d%ZA2MAoZf|5|AUz-^ wL2_qxZDnqBOlfm;dwmKC2?>1)m!Yl!E0@3^0#cU}uK^i{8dUc3&{Q*^#A|> delta 23 fcmX?lkoU&{-i8*&EleFD?N>vXwqFfl{=f|Yh2RQ+ diff --git a/internal/php7/php7.y b/internal/php7/php7.y index 928b3d1..389d96b 100644 --- a/internal/php7/php7.y +++ b/internal/php7/php7.y @@ -2497,6 +2497,10 @@ non_empty_for_exprs: anonymous_class: T_CLASS ctor_arguments extends_from implements_list backup_doc_comment '{' class_statement_list '}' { + if $2 == nil { + $2 = &ArgumentList{} + } + class := &ast.StmtClass{ Position: yylex.(*Parser).builder.NewTokensPosition($1, $8), ClassTkn: $1,