ElkArte Community

Title: Flow interruptions in subs
Post by: emanuele on June 16, 2014, 12:02:41 pm
The same as controllers should be "query-free", subs should not have any interruption of the "flow".
What do I mean? Things like isAllowedTo, fatal_lang_error, etc. that "hard-stop" the code and force php to present another page to the user.

At the moment the situation in ElkArte 1.0 is the following:
isAllowedTo 25
fatal_lang_error and fatal_error 92
redirectexit 5
obExit 13
die 2
exit 10
Title: Re: Flow interruptions in subs
Post by: Spuds on June 16, 2014, 08:27:02 pm
Good points :D ... the security checks etc should be back in the controllers.   Looks like some more fun in 1.1 !
Title: Re: Flow interruptions in subs
Post by: Joshua Dickerson on June 25, 2014, 03:58:22 pm
Not sure of when and where but there may be a time when you want to do some kind of security check outside of the controller. In which case, you need to inject the user and the security stuff. When you do that, you should be returning an exception so that it can be caught.
Title: Re: Flow interruptions in subs
Post by: Joshua Dickerson on February 05, 2015, 11:14:51 pm
Some good news:

isAllowedTo 7
fatal_lang_error 75
fatal_error 3
redirectexit 2
obExit 11
die 2 (Graphics.subs.php for reference)
* exit 10

Going off of the current development branch
Title: Re: Flow interruptions in subs
Post by: emanuele on February 13, 2015, 02:42:44 pm
Where did all that stuff go? LOL
I don't remember so many changes! xD