https://bugzilla.wikimedia.org/show_bug.cgi?id=50134
Web browser: ---
Bug ID: 50134
Summary: Hook functions should not be required to return value
Product: MediaWiki
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: General/Unknown
Assignee: [email protected]
Reporter: [email protected]
Classification: Unclassified
Mobile Platform: ---
When a hook neglects to return a value, Hooks::run throws an MWException with
the message "Detected bug in an extension! Hook $func failed to return a value;
should return true to continue hook processing or false to abort."
This is a frustrating gotcha that has caused us some serious in the past (see
bug 49727 for a recent example). Most hook handlers are written with the intent
of complementing or augmenting core functionality rather than vetoing it,
making it quite natural for a developer to forget that the caller is waiting
for permission to proceed. The potential for confusion is magnified by the fact
that DOM event handlers and jQuery event handlers are not required to return an
explicit value for the handled event to continue propagating.
We should tolerate implicit and explicit null return values from hook handlers.
Making this change should not break anything, as any hook handler currently
returning null is treated as an error.
--
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l