FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-2913: avoid infinite loop when resolving constant type by dantleech · Pull Request #2943 · phpactor/phpactor · GitHub

gh-2913: avoid infinite loop when resolving constant type - #2943

Merged
dantleech merged 1 commit into
masterfrom
gh-2913-infinite-loop
Oct 17, 2025
Merged

gh-2913: avoid infinite loop when resolving constant type#2943
dantleech merged 1 commit into
masterfrom
gh-2913-infinite-loop

Conversation

Copy link
Copy Markdown
Collaborator

When we have a cycle such as declare('Foo', Foo) PHP will bail at runtime because it will evaluate Foo before declare. Phpactor will evalute Foo lazily - but even if it located it eagerly (bad for performance) the indxer will find the constant, because the indexer doesn't know that the value causes a cycle.

for now we only evaluate literal values.

Fixes #2913

When we have a cycle such as `declare('Foo', Foo)` PHP will bail at
runtime because it will evaluate `Foo` before `declare`. Phpactor will
evalute `Foo` lazily - but even if it located it eagerly (bad for
performance) the indxer _will find_ the constant, because the indexer
doesn't know that the value causes a cycle.

for now we just avoid resolving values if they are QualifiedName's.
dantleech force-pushed the gh-2913-infinite-loop branch from a25a09b to a22af93 Compare October 17, 2025 14:12
dantleech merged commit 7f1a270 into master Oct 17, 2025
11 checks passed
dantleech deleted the gh-2913-infinite-loop branch October 17, 2025 14:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Orphaned language-server:diagnostics Process When File Contains namespace Timer

1 participant


Back | FazBrowse Home | New Git URL