com php-src: Fix AST printing of nullable builtin types: Zend/tests/assert/expect_015.phpt Zend/zend_ast .c

From: Date: Wed, 04 Dec 2019 10:20:52 +0000
Subject: com php-src: Fix AST printing of nullable builtin types: Zend/tests/assert/expect_015.phpt Zend/zend_ast .c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-109377@lists.php.net to get a copy of this message
Commit: fac43d6515adb932083edeacd40f87d6b8393d66 Author: Nikita Popov <nikita.ppv@gmail.com> Wed, 4 Dec 2019 11:20:52 +0100 Parents: c8e9aa854cb722855dad450bff5815326853ff6a Branches: PHP-7.3 PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fac43d6515adb932083edeacd40f87d6b8393d66 Log: Fix AST printing of nullable builtin types Fixes oss-fuzz #19109. Bugs: https://bugs.php.net/19109 Changed paths: M Zend/tests/assert/expect_015.phpt M Zend/zend_ast.c Diff: diff --git a/Zend/tests/assert/expect_015.phpt b/Zend/tests/assert/expect_015.phpt index 72f13ff83f1..7f8b0a09358 100644 --- a/Zend/tests/assert/expect_015.phpt +++ b/Zend/tests/assert/expect_015.phpt @@ -94,7 +94,7 @@ L0: } })); -assert(0 && ($a = function &(array &$a, X $b = null) use ($c,&$d) : X { +assert(0 && ($a = function &(?array &$a, X $b = null) use ($c,&$d) : X { class A { use T1, T2 { T1::foo insteadof foo; @@ -244,7 +244,7 @@ Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null) use($c, })) failed in %sexpect_015.php on line %d -Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null) use($c, &$d): X { +Warning: assert(): assert(0 && ($a = function &(?array &$a, X $b = null) use($c, &$d): X { class A { use T1, T2 { T1::foo insteadof foo; diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 876200bee87..d007e01480d 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -1463,7 +1463,7 @@ simple_list: } break; case ZEND_AST_TYPE: - switch (ast->attr) { + switch (ast->attr & ~ZEND_TYPE_NULLABLE) { case IS_ARRAY: APPEND_STR("array"); case IS_CALLABLE: APPEND_STR("callable"); EMPTY_SWITCH_DEFAULT_CASE();

« previous php.cvs (#109377) next »