Jump to content

Hook return value & logic workflow


bytebeam

Recommended Posts

Usually, systems accepting custom hooks implement basic error checking by testing the return value of hook functions. This allows the hooked process to decide the appropriate course of action according to the hook's returned value (for ex. continue in case of success or abort in case of failure, etc...).

 

In a PHP function this means simply returning false or true, 0 or 1, an array, or any other established convention.

 

I'm surprised I don't see return values in the source code of hook functions I have checked. It is difficult to imagine that the hooked processes do not already perform themselves due error checking over their normal original workflow. Can somebody confirm that hook functions can return some kind of values which can condition further normal WHMCS processing ?

Link to comment
Share on other sites

No replies... Then I guess WHMCS does not check the return value of hook functions.

 

I did find one thread about the same matter:

http://forum.whmcs.com/showthread.php?67007-hook-error-handling-not-documented&highlight=hook

 

However it does not clarify if the $errormessage variable is merely devoted to the display of error messages, or if the normal workflow of a hooked process is altered according to the contents of this variable.

 

Any hints ?

Link to comment
Share on other sites

  • 6 months later...
No replies... Then I guess WHMCS does not check the return value of hook functions.

 

I did find one thread about the same matter:

http://forum.whmcs.com/showthread.php?67007-hook-error-handling-not-documented&highlight=hook

 

However it does not clarify if the $errormessage variable is merely devoted to the display of error messages, or if the normal workflow of a hooked process is altered according to the contents of this variable.

 

Any hints ?

 

To find out what the inner workings of whmcs hook points are doing in regards to errors you would need to speak to the developers.

 

All i can tell you is broken hooks/modules will often result in blank pages so that tells me there is as far as i can tell no graceful fallback in these cases. If you find out it is the case then ofcourse you can put in a feature request, or at the very lease suggest to the devs directly a method that would deal with your case.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated