Bug #79897 [PATCH]: Promoted constructor params with attribs cause crash

From: Date: Thu, 30 Jul 2020 07:25:35 +0000
Subject: Bug #79897 [PATCH]: Promoted constructor params with attribs cause crash
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228291@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79897&edit=1 ID: 79897 Patch added by: sample@email.tst Reported by: deusekane at gmail dot com Summary: Promoted constructor params with attribs cause crash Status: Open Type: Bug Package: Compile Failure Operating System: Windows PHP Version: 8.0Git-2020-07-25 (Git) Block user comment: N Private report: N New Comment: The following patch has been added/updated: Patch Name: pHqghUme Revision: 1596093935 URL: https://bugs.php.net/patch-display.php?bug=79897&patch=pHqghUme&revision=1596093935 Previous Comments: ------------------------------------------------------------------------ [2020-07-30 07:25:34] sample at email dot tst The following patch has been added/updated: Patch Name: pHqghUme Revision: 1596093934 URL: https://bugs.php.net/patch-display.php?bug=79897&patch=pHqghUme&revision=1596093934 ------------------------------------------------------------------------ [2020-07-25 11:38:44] nikic@php.net Same as bug #79878. ------------------------------------------------------------------------ [2020-07-25 11:15:28] deusekane at gmail dot com The following pull request has been associated: Patch Name: Fixed crash that occurred when a promoted constructor parameter had an attribute On GitHub: https://github.com/php/php-src/pull/5891 Patch: https://github.com/php/php-src/pull/5891.patch ------------------------------------------------------------------------ [2020-07-25 11:14:35] deusekane at gmail dot com Description: ------------ When a class constructor argument has both a visibility modifier and an attribute, and that attribute has at least one argument, the PHP interpreter crashes when attempting to compile it. This is due to the AST node for the attribute being used twice, once to create a parameter attribute and once to create a class property attribute. The linked pull request fixes this bug by creating a temp copy of the attrib AST to use for the class property. https://github.com/php/php-src/pull/5891 Test script: --------------- <?php <<Attribute>> class B { public function __construct($value) { } } class A { public function __construct( <<B(12)>> public $b ) { } } Expected result: ---------------- No output; php parser is able to process the file Actual result: -------------- Crash with ZEND_ASSERTION_FAILED. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79897&edit=1

« previous php.bugs (#228291) next »