Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal error: Property $_bezeichnung was not found in reflection of class Application_Model_Artgroesse #6944

Closed
staabm opened this issue Mar 30, 2022 · 10 comments

Comments

@staabm
Copy link
Contributor

staabm commented Mar 30, 2022

Bug report

not sure this is related to 1.5.1 or 1.5.2 but maybe the exception trace rings a bell

Post the following stack trace to https://github.com/phpstan/phpstan/issues/new?template=Bug_report.md: 
#0 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Type/ObjectType.php(152): PHPStan\Reflection\ClassReflection->getProperty()
#1 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Type/ObjectType.php(158): PHPStan\Type\ObjectType->getUnresolvedPropertyPrototype()
#2 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Type/StaticType.php(162): PHPStan\Type\ObjectType->getUnresolvedPropertyPrototype()
#3 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Type/StaticType.php(157): PHPStan\Type\StaticType->getUnresolvedPropertyPrototype()
#4 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(4049): PHPStan\Type\StaticType->getProperty()
#5 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(4056): PHPStan\Analyser\MutatingScope->getPropertyReflection()
#6 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(1901): PHPStan\Analyser\MutatingScope->propertyFetchType()
#7 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(1907): PHPStan\Analyser\MutatingScope->PHPStan\Analyser\{closure}()
#8 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(543): PHPStan\Analyser\MutatingScope->resolveType()
#9 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Rules/FunctionReturnTypeCheck.php(52): PHPStan\Analyser\MutatingScope->getType()
#10 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Rules/Methods/ReturnTypeRule.php(43): PHPStan\Rules\FunctionReturnTypeCheck->checkReturnType()
#11 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(102): PHPStan\Rules\Methods\ReturnTypeRule->processNode()
#12 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Node/ClassStatementsGatherer.php(95): PHPStan\Analyser\FileAnalyser->PHPStan\Analyser\{closure}()
#13 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(452): PHPStan\Node\ClassStatementsGatherer->__invoke()
#14 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php([360](https://github.com/complex-gmbh/fare/runs/5751321224?check_suite_focus=true#step:14:360)): PHPStan\Analyser\NodeScopeResolver::PHPStan\Analyser\{closure}()
#15 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(305): PHPStan\Analyser\NodeScopeResolver->processStmtNode()
#16 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(467): PHPStan\Analyser\NodeScopeResolver->processStmtNodes()
#17 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(305): PHPStan\Analyser\NodeScopeResolver->processStmtNode()
#18 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(551): PHPStan\Analyser\NodeScopeResolver->processStmtNodes()
#19 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(276): PHPStan\Analyser\NodeScopeResolver->processStmtNode()
#20 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(189): PHPStan\Analyser\NodeScopeResolver->processNodes()
#21 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(143): PHPStan\Analyser\FileAnalyser->analyseFile()
#22 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97): PHPStan\Command\WorkerCommand->PHPStan\Command\{closure}()
#23 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/clue/ndjson-react/src/Decoder.php(110): _PHPStan_22f755c6a\Evenement\EventEmitter->emit()
#24 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97): _PHPStan_22f755c6a\Clue\React\NDJson\Decoder->handleData()
#25 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/Util.php(62): _PHPStan_22f755c6a\Evenement\EventEmitter->emit()
#26 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(97): _PHPStan_22f755c6a\React\Stream\Util::_PHPStan_22f755c6a\React\Stream\{closure}()
#27 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/DuplexResourceStream.php(154): _PHPStan_22f755c6a\Evenement\EventEmitter->emit()
#28 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(201): _PHPStan_22f755c6a\React\Stream\DuplexResourceStream->handleData()
#29 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(173): _PHPStan_22f755c6a\React\EventLoop\StreamSelectLoop->waitForStreamActivity()
#30 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(106): _PHPStan_22f755c6a\React\EventLoop\StreamSelectLoop->run()
#31 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Command/Command.php(259): PHPStan\Command\WorkerCommand->execute()
#32 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(856): _PHPStan_22f755c6a\Symfony\Component\Console\Command\Command->run()
#33 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(259): _PHPStan_22f755c6a\Symfony\Component\Console\Application->doRunCommand()
#34 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(157): _PHPStan_22f755c6a\Symfony\Component\Console\Application->doRun()
#35 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(94): _PHPStan_22f755c6a\Symfony\Component\Console\Application->run()
#36 phar:///home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(95): _PHPStan_22f755c6a\{closure}()
#37 /home/runner/work/fare/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan(8): require('...')
#38 /home/runner/work/fare/fare/vendor/bin/phpstan(117): include('...')
#39 {main}
Error: Internal error: Internal error: Property $_bezeichnung was not found in reflection of class Application_Model_Artgroesse. in file /home/runner/work/fare/fare/library/Fare/Application/Model/Artgroesse.php
@mergeable
Copy link

mergeable bot commented Mar 30, 2022

This bug report is missing a link to reproduction on phpstan.org.

It will most likely be closed after manual review.

@clxkoders
Copy link

not sure this is related to 1.5.1 or 1.5.2 but maybe the exception trace rings a bell

the error does not occur with 1.5.1, only with 1.5.2

@ondrejmirtes
Copy link
Member

Can you please create a small reproducing repository that shows this problem? Looks like somehow traits are involved. Thanks.

@staabm
Copy link
Contributor Author

staabm commented Mar 30, 2022

we are not yet able to reproduce the error locally. only happens in github actions. need to investigate.

@zacharylund
Copy link

I've create a way to reproduce the same issue with a class method instead of a class property here: https://github.com/zacharylund/phpstan-dup-class-poc

I'm pretty sure this has to do with legacy code with (non-namespaced) duplicated class names in different directories.

I see this in my CI environment as well, and it was hard to reproduce locally until I set the maximum number of processes to 1, which is how it runs in CI. I suspect multiple processes on a large repo means the duplicated class names don't get analyzed in the same process and therefore don't fail.

I think the issue is this line: phpstan/phpstan-src@22f755c#diff-3887df0457831e1b8fd86144e1d07a7737643885122108493625853be7f4a198R1135

Description was previously assigned as:

$thisReflection = $this->getClassReflection();
$description = $this->describeCache() . '-' . $thisReflection->getCacheKey();

Now it is assigned as:

$description = $this->describeCache();

Reverting this line fixes the error in my example repo.

This also appears to be cache related because running PHPStan 1.5.1 works, upgrading to 1.5.2 works until you clear cache and then 1.5.2 fails.

@staabm
Copy link
Contributor Author

staabm commented Apr 1, 2022

Thanks for this great investigation.

We also had the impression that its cache related.. maybe 1.5.2 also misses a cache-key change and therefore the error only happens after clearing it manually?

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src@81abfb4 + 970a7f0

@staabm
Copy link
Contributor Author

staabm commented Apr 14, 2022

Thank you for fixing. It was a blocker for us, and I did not yet have an idea on how to fix it

@zacharylund
Copy link

Thank you!

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants