Skip to content

Conversation

@TNSelahle
Copy link
Member

Removing unnecessary entries from the binding table.

Fixes https://github.com/ShiftLeftSecurity/codescience/issues/8573

@TNSelahle TNSelahle self-assigned this Dec 3, 2025
diffGraph.addEdge(typeDecl, bindingNode, EdgeTypes.BINDS)
diffGraph.addEdge(bindingNode, method, EdgeTypes.REF)
otherBodyStmts.flatMap(_.root).collect {
case method: NewMethod if method.name != "<global>" =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a the <global> method in the bodyStmts of a class already seems wrong. Please fix that instead of filtering this method out here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ml86 this seems to be due to how the parser represents this.
image

There is a PhpClassLikeStmt for <global>, and in that, a PhpMethodDecl for <global>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concluded in zoom that we want to go ahead with the current status as changing it would be a too big refactoring for now.

@TNSelahle TNSelahle changed the title fix: binding table fix [php2cpg] fix: binding table fix Dec 4, 2025
@TNSelahle TNSelahle force-pushed the tebogo/fix-binding-table branch from 1a114e9 to f13cc7a Compare December 17, 2025 08:42
@ml86 ml86 self-requested a review December 17, 2025 14:43
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.

3 participants