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

[Bug] [php2cpg] call do not resolve to parent class method when child class do not have overload method #4823

Open
vigov5 opened this issue Aug 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@vigov5
Copy link

vigov5 commented Aug 2, 2024

Describe the bug
I have this minimal example where Joern can't resolve the call from child class B to the function in parent class A when class B does not have an overloaded method.

To Reproduce

<?php

class A
{
    public static function test($x)
    {
        echo $x;
    }
}

class B extends A
{
}

B::test("hello");

Shell result:

joern> cpg.call.name("test").head.callOut.l
val res5: List[io.shiftleft.codepropertygraph.generated.nodes.Method] = List(
  Method(
    astParentFullName = "<global>",
    astParentType = "NAMESPACE_BLOCK",
    code = "<empty>",
    columnNumber = None,
    columnNumberEnd = None,
    filename = "<empty>",
    fullName = "B::test",
    hash = None,
    isExternal = true,
    lineNumber = None,
    lineNumberEnd = None,
    name = "test",
    offset = None,
    offsetEnd = None,
    order = 0,
    signature = "<unresolvedSignature>(1)"
  )
)

Expected behavior
If the method is not found in the current class, the frontend can look up the same one in parent classes (if possible)

@vigov5 vigov5 added the bug Something isn't working label Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant