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

Scan op_array->literals for class and function dependencies #135

Open
dktapps opened this issue Nov 23, 2023 · 1 comment
Open

Scan op_array->literals for class and function dependencies #135

dktapps opened this issue Nov 23, 2023 · 1 comment

Comments

@dktapps
Copy link
Member

dktapps commented Nov 23, 2023

A possible rather simple solution to issues like #111 and #115.

My initial thought was to scan the op_array for opcodes like NEW, INIT_FCALL etc to find dependencies. However, these opcodes all have different operand layouts, making it particularly inconvenient to retrieve dependencies.

A simpler option, though a bit uglier, is to just scan op_array->literals for IS_STRING zvals and then check if there are any functions or classes in the current file with the same name. This might end up copying some irrelevant stuff in some cases (if a user string happens to have the same name as a function declared in the current file), but would probably be much more robust and require less maintenance.

@dktapps
Copy link
Member Author

dktapps commented Nov 24, 2023

This is also a problem for global constants. Unfortunately, it's not possible to tell where a constant was declared, which is problematic.

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

No branches or pull requests

1 participant