-
Notifications
You must be signed in to change notification settings - Fork 41
Regression in 1.28.x: changed hook order breaks existing functionality #6652
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
Comments
Also note that views by intention "wants" its hooks to run late. See this module weight approach in its install file. So it seems that this setting of module weight's quite pointless: https://github.com/backdrop/backdrop/blob/1.x/core/modules/views/views.install#L11 Is that correct? EDIT: it isn't. |
It is not pointless: |
(the last invoked hooks is relative. I guess 10 has been chosen because all the other Backdrop core modules use a lower weight. If a new Backdrop core module were to set its weight to 100, Views hooks would not be anymore the last invoked hooks.) |
@kiamlaluno if that assumption is right, I wonder why the order of hooks effectively changed. Id did, obviously. Edit: the order of hook_menu_alter() only. Re module_set_weight() - as an addendum: not only core modules, but any module, including contrib and custom. This is, how the order worked, but something changed, and that has a potential for regressions like the one i18n_taxonomy currently has to deal with. That submodule sets its weight to 5, so until 1.28.0 views hooks reliable ran after i18n_taxonomy hooks, but now views hooks run before i18n_taxonomy hooks. For sure hook_menu_alter() now runs in different order. |
Yes, |
@kiamlaluno I wonder, how that should help with the reported problem, though. 😉 I only mentioned module_set_weight() in a previous comment, to clarify the "late run" of views hooks was by intention. Sorry, if that was misleading. |
It was a comment for views by intention "wants" its hooks to run late to mean that is not really the intention of the Views module, as the recent change shows. Contributed modules should not assume that a specific hook implementation is executed before or after another one, which also means that contributed modules should not assume a Backdrop core module will not implement (As a side note, I find that adding new hooks is probably more risky for compatibility with existing modules.) |
Thanks for opening this, @indigoxela. I think the rationale for that change was that, since Views is able to create menu routes and menu items, and since it does not have an easy way to provide icons for those, @quicksketch probably moved Changing the execution order of And I agree with @indigoxela in the observation that the Views module has a weight of 10 (instead of the default 0) in order to assure that its hooks run toward the end. Only a couple other core modules have higher weights: admin bar, layout, contextual and standard.profile. So, defeating this by modifying this hook order was bound to create issues. Granted, the breakage of |
@kiamlaluno Hm, honestly, I have to contradict at least the "vibe" of your comment. (Maybe that vibe wasn't intentional, though...) Changing the hook order is quite a change - even for a minor release. We should warn people - be it in the release notes or wherever. Three developers perfectly familiar with Backdrop scratched their head for quite a while to figure out, why all term pages are broken all of a sudden (in specific setups). For the i18n problem, the solution will (very likely) be a new i18n release. Just stating "you shouldn't have assumed the order, anyway" is IMO not the way to deal with that. |
@indigoxela Truly, the comment says contributed modules should not assume a Backdrop core module will not implement |
Description of the bug
That issue comment by @argiepiano in i18n issue queue explains what happened in core when adding SVG icons: backdrop-contrib/i18n#134 (comment)
As the order of hooks - actually only hook_menu_alter - changed, the whole logic changed a bit. That caused a severe problem in i18n, but might also cause problems elsewhere.
For i18n, for example, it means that taxonomy term pages overridden by views aren't accessible anymore since 1.28.0.
Steps To Reproduce
See the contrib queue issue for an example.
It may be, that this only affects one contrib module, but I actually doubt that. On the other hand I see, why this has been done, so we might eventually not even be able to fix this.
However, it's a potentially breaking change and we should warn people.
Additional information
This is the function: https://github.com/backdrop/backdrop/blob/96a0e03870c9fd09ab4134827a05148173e8e516/core/modules/views/views.module#L552
The text was updated successfully, but these errors were encountered: