register_plugin_hook priority isn't applied globally
|Reported by:||twall||Owned by:|
|Priority:||normal||Milestone:||Long Term Future Release|
The priority passed in with register_plugin_hook only affects the hook's priority in relation to other hooks registered with the same hook/object type.
To ensure a hook is run first, you must both specify a priority of '0' AND specify both the hook and entity type. To ensure a hook is run last, you must specify a priority of 1000 and use 'all'/'all' as the hook/object type. Using hook names and entity types other than what is appropriate, simply to affect the priority, is what makes me consider this a bug.
The following sets of hooks are executed in order:
It may not be possible to merge these sets after registration, since the original ordering information is no longer available. However, executing as they do results in the wrong results for priority.
Specificly, my 'check_permissions'/'object' hook will always be overridden by the 'check_permissions'/'all' hook set up by someone else, regardless of priority.
Change History (3)
comment:2 Changed 3 years ago by brettp
- Milestone changed from Elgg 1.7 to Elgg 2.0
- Type changed from unconfirmed defect to confirmed defect