Welcome Guest, Not a member yet? Register   Sign In
How to enable debug toolbar in CI4.0.0-rc.3
#18

(This post was last modified: 01-17-2020, 03:46 PM by JNapolitanoIT.)

Hey there.

I would like to add my two cents on this topic. First off, might I suggest that instead of using the following code block to access/manipulate session data:

Code:
    ....
    if (isset($_SESSION['user_session'])) {
      $user_session = TRUE;
    }
    ....

that you use the built-in session library instead. This way you don't have to worry too much about sessions closing early, or not at all, or not on time, etc. The session library was built to do the heavy lifting for you so you don't have to worry about anything else.

For example, the way to do this is to call the Sessions service using its helper function like so:
Code:
$session = session();

Now, you can access your session data easily. Reformatting your code from before to utilize this would look like the following:

Code:
    ....
    if (isset($session->get('user_session'))) {
      $user_session = TRUE;
    }
    ....

    // OR, you can use a little 'magic' =)

    ....
    if (isset($session->user_session)) {
      $user_session = TRUE;
    }
    ....

You can read more about it here. The reason I bring this up is because the way you're accessing session data could impact the debug toolbar. For example, see here. Also it is always best to utilize the frameworks built-in libraries for consistency across your application. After this, you may want to make sure your write permissions are properly set for the following directory:

Code:
writable/debugbar/

I hope this helps you out and I am not talking out of my hind-end Tongue
A reader lives a thousand lives before he dies. The man who never reads lives only one.
George R.R. Martin

Reply


Messages In This Thread
RE: How to enable debug toolbar in CI4.0.0-rc.3 - by JNapolitanoIT - 01-17-2020, 03:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB