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

[2.1] Hooks list add support for leading backslash namespaces #8372

Open
wants to merge 2 commits into
base: release-2.1
Choose a base branch
from

Conversation

MissAllSunday
Copy link
Contributor

By default, hook list in maintenance relies on the file property to determinate if a hook is enable/active via setting its abs path.

For larger mods or mods that relies on autoloaders the file property might not be defined for all hooks, making them appear as "the hook has not been found" on the hook list.

This PR adds a check to see if a hook has its correspondence with the list of already loaded functions, if found it sets its absPath which in return the hook list will correctly list them as active.

@MissAllSunday MissAllSunday changed the title Hooks list add support for hooks not using file property [2.1] Hooks list add support for hooks not using file property Dec 24, 2024
@live627
Copy link
Contributor

live627 commented Dec 25, 2024

Which mod must I install to find the error? It seems to work with my Custom Form mod. What am I missing here?

@MissAllSunday
Copy link
Contributor Author

Ahhh I see it now, upon further inspection the only difference between your mod and mine (where the issue was reported) is a leading backslash in the namespace:

Yours: 'CustomForm\Integration::helpadmin'
Mine: '\PostLimit\PostLimitAlerts::handle'

Trimming it resolves the issue altogether so no need to pass the previous function_list to match.

I prefer usage of leading backslash to make it clear its an absolute path instead of a relative one but I left it to the team if this case should be taken into consideration or not.

@MissAllSunday MissAllSunday changed the title [2.1] Hooks list add support for hooks not using file property [2.1] Hooks list add support for leading backslash namespaces Dec 26, 2024
@live627
Copy link
Contributor

live627 commented Dec 28, 2024

well, sine php accepts that syntax perhaps we should too.

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.

2 participants