Bug #79897 [NEW]: Promoted constructor params with attribs cause crash
| From: | deusekane at gmail dot com | Date: | Sat, 25 Jul 2020 11:14:35 +0000 |
| Subject: | Bug #79897 [NEW]: Promoted constructor params with attribs cause crash | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-228223@lists.php.net to get a copy of this message | ||
From: deusekane at gmail dot com
Operating system: Windows
PHP version: 8.0Git-2020-07-25 (Git)
Package: Compile Failure
Bug Type: Bug
Bug description:Promoted constructor params with attribs cause crash
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 bug report at https://bugs.php.net/bug.php?id=79897&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79897&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79897&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79897&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79897&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79897&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79897&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79897&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79897&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79897&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79897&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79897&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79897&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79897&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79897&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79897&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79897&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79897&r=mysqlcfg