MyBB Community Forums

Full Version: Plugins can't return *empty* values to hooks.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In , the returned value is checked just using if:

That means
    "" (an empty string)
    0 (0 as an integer)
    0.0 (0 as a float)
    "0" (0 as a string)
    array() (an empty array)

can't be returned by plugins and that's too restrictive.

IMO we should check the returned value using isset() so that only NULL is excluded.

There *might* be issues when multiple plugins hook to a same hook if we make changes here, though I'm not sure. But I think it's worth removing the restrict.


If a hooked function is called via the variable function , the returned value is what the hooked function returns.
But if a hooked function is called via call_user_func_array() , if the returned value is FALSE, it might also be that call_user_func_array() is having errors on the hooked function. Ref .

I don't quite understand using call_user_func_array() over call_user_func() here. The latter one only returns what the callback returns. Ref .
I agree that isset should be used instead.
I think this is worth changing.

Thank you for your report. We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.

Follow this link to visit the issue on Github:

Thanks for contributing to MyBB!

The MyBB Group