Wrong hook name

145
Defect
arturo182
Jack
2.0
0.4
Plugins
Fixed
Normal
Minor
7 years ago
3 years ago
0

Description

So I was working on a cool new plugin (top secret xD) and found a bug, actually two. When I add hooks there's a hook named "handler_tickets" but in handlers/tickets.php there's [code]($hook = FishHook::hook('tickets_handler')) ? eval($hook) : false;[/code]

also in line 204 of the same file there's [code]($hook = FishHook::hook('tickets_columns')) ? eval($hook) : false;[/code] which is not on the hooks list.

Ticket History

7 years and 6 months ago by arturo182

Maybe it would be better if instead of using string names you'd use defines, that way code wouldn't be less readable but it would be harder to make mistakes.

Something like: [code]define('HOOK_GLOBALS', 1);[/code]

7 years and 6 months ago by Jack

So instead of like [code]($hook = FishHook::hook('hook_name')) ? eval($hook) : false;[/code] it would be [code]($hook = FishHook::hook('HOOK_NAME')) ? eval($hook) : false;[/code]

or did I not understand? (tired >_>)

7 years and 6 months ago by Jack

  • Closed ticket as Fixed

Fixed invalid name and added missing location.

7 years and 6 months ago by arturo182

no, it would be: [code]($hook = FishHook::hook(HOOK_NAME)) ? eval($hook) : false;[/code]

and that way if you misspell it there will be a warning (or error I don't remember right now) telling you that such define does not exist.