Bug #81630 [Ver->Csd]: PHP 8.1: ReflectionClass->getTraitAliases() crashes with Internal error

From: Date: Wed, 17 Nov 2021 14:55:56 +0000
Subject: Bug #81630 [Ver->Csd]: PHP 8.1: ReflectionClass->getTraitAliases() crashes with Internal error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237818@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81630&edit=1 ID: 81630 Updated by: git@php.net Reported by: ondrej at mirtes dot cz Summary: PHP 8.1: ReflectionClass->getTraitAliases() crashes with Internal error -Status: Verified +Status: Closed Type: Bug Package: Reflection related Operating System: N/A PHP Version: 8.1.0RC6 Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikic Revision: https://github.com/php/php-src/commit/6641e3b8f42795bd5955f59112c459435131d5ba Log: Fix bug #81630: Don't claim known hash in getTraitAliases() Previous Comments: ------------------------------------------------------------------------ [2021-11-17 14:28:05] nikic@php.net Thanks, I can reproduce with the provided repo. ------------------------------------------------------------------------ [2021-11-17 13:47:17] ondrej at mirtes dot cz There’s a repository that shows the bug inside Docker: https://github.com/edubacco/phpstan-bug-5954-php81 I tried to reproduce it outside of PHPStan but with no luck :/ It also doesn’t help thst the Laravel classes and traits are so huge. ------------------------------------------------------------------------ [2021-11-17 13:43:12] nikic@php.net Any non-simple way of reproducing it (like running phpstan tests?) I don't think this is directly related to getTraitAliases(), the exception indicates that the ReflectionClass object is not fully uninitialized. ------------------------------------------------------------------------ [2021-11-17 12:55:14] ondrej at mirtes dot cz Description: ------------ Unfortunately I don't have a simple reproducing script here, but I know there's a bug in ReflectionClass when asking for trait aliases. A code that executes the same methods crashes when I run it in context of PHPStan: https://3v4l.org/oSI4m The error message is: Uncaught Error: Internal error: Failed to retrieve the reflection object in phar:///var/www/html/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/Php/PhpClassReflectionExtension.php:576 #0 phar:///var/www/html/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/Php/PhpClassReflectionExtension.php(576): ReflectionClass->getTraitAliases() #1 Maybe it's related to some internal state of ReflectionClass or maybe the way how it was obtained, but calling ReflectionClass->getTraitAliases() always results in a crash on PHP 8.1. It works on PHP 8.0. Hopefully this gives you enough information to track it down. Thanks. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81630&edit=1

« previous php.bugs (#237818) next »