#145 - Wrong hook name
Type Defect
Status Fixed
Milestone 2.0
Version 0.4
Component Plugins
Priority Normal
Severity Minor
Owner arturo182
Assigned to Jack
Reported 14 years ago
Updated 11 years ago
Votes 0
Related tickets
Proposed time
Worked time

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

14 years and 8 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]

14 years and 8 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 >_>)

Jack closed as Fixed 14 years and 8 months ago

Fixed invalid name and added missing location.

14 years and 8 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.