On 22/09/2007, Voice of All jschulz_4587@msn.com wrote:
I don't see the problem. A hooked function call returning 'false' means failure and all other functions attached to that hook are skipped. In such a case, $result is null. A hooked function call returning true doesn't mean that $result is true, it just means that it ran without running into something considered exceptional.
Seeing that a password is invalid is not exceptional and the hook returns true. $result is passed by reference, and will be what it should after the hook is called. It can be true or false if the hook ran within normal parameters (or at all), or null if not (denoted by the hooked function returning false).
Hooks return true or false to indicate whether or not further processing should continue. Where a boolean result is also needed, a hook can provide this using, e.g. a variable passed by reference, as is the case here.
To indicate that a password is not valid, you would set $result to false and return false; returning false causes the hook chain to be aborted (so any additional methods subscribed to that hook won't override the $result) and indicates that MediaWiki shouldn't perform internal checks to determine whether or not the password is valid; the value of $result is then used.
This is how hooks work.
Rob Church