Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: @rjen on July 26, 2022, 03:07:21 AM

Title: Deactivating hooks does not work?
Post by: @rjen on July 26, 2022, 03:07:21 AM
I am fiddling around with some mods that use hooks and I was trying to deactivate a hook from the Integration hook maintenance screen, to find that it seems to be behave erratically..

SMF2.1.2, vanilla install

I have a Mod that uses integrate_credits hook: Installs fine and works fine.
Note: this mod is an example, the same behaviour with other mods: this is not mod related but SMF related...

Install code in the package-info.xml:
<hook hook="integrate_credits" function="recent_top_credits" file="$sourcedir/Subs-recent_top.php" />

Results in this entry in the settings table:
variable: integrate_credits
value: $sourcedir/Subs-recent_top.php|recent_top_credits

All works fine: Credits are showing..

Then I go to the Hooks maintenance page in admin and I try to deactivate the hook.
2022-07-26_085814.jpg

The result is showing as below:
2022-07-26_085937.jpg

I am expecting the hook to be disabled now, but to my surprise it still shows the credits from the disabled hook to users...
2022-07-26_090057.jpg

The settings table is updated as follows:
variable: integrate_credits
value: $sourcedir/Subs-recent_top.php|recent_top_credits,recent_top_credits!

Then I reactivate the hook, which results in the credits showing twice...(!)
2022-07-26_090340.jpg

2022-07-26_090421.jpg

Basically when I now uninstall the mod I am left with orphaned entries in the settings table...

2022-07-26_090617.jpg

Is this intentional or is this a bug?

I would expect the hooks maintenance to allow me to actually deactivate the functionality of a certain hook completely, and to be able to reactivate it without 'doubling up' the functionality...
Title: Re: Deactivating hooks does not work?
Post by: @rjen on July 28, 2022, 12:05:22 PM
The lack of response seems to indicate that this is an issue no one else has???
Title: Re: Deactivating hooks does not work?
Post by: Diego Andrés on July 28, 2022, 12:16:15 PM
I think the general opinion is that something is wrong with this section but it's unreliable to reproduce the issues.
Though some have been fixed like the slow loading, and re-enabling the hooks.

Shawn opened an issue for other issue but seems the bug went away? https://github.com/SimpleMachines/SMF/issues/7372
Title: Re: Deactivating hooks does not work?
Post by: @rjen on July 28, 2022, 12:23:56 PM
Urr? Something is wrong with section, but cannot reproduce ?

This happens on a clean install of 2.1.2. Has anyone tried to reproduce it? The bug you are referring to is not the same as I reported ...
Title: Re: Deactivating hooks does not work?
Post by: Diego Andrés on July 28, 2022, 12:25:34 PM
I know it's not the same, just pointing out that there are issues with the section, but somehow everyone gets a different result with their different actions.
As for this one, I already marked it as confirmed as it can definitely be reproduced.
Title: Re: Deactivating hooks does not work?
Post by: @rjen on July 28, 2022, 12:44:26 PM
Ok, thanks
Title: Re: Deactivating hooks does not work?
Post by: shawnb61 on December 21, 2022, 10:21:25 PM
Issue logged:
https://github.com/SimpleMachines/SMF/issues/7634