1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Server Error Log entries due to addition of code to session.php file

Discussion in 'XenForo Development Discussions' started by AndyB, Jul 18, 2013.

  1. AndyB

    AndyB Well-Known Member

    I'm getting the following Server Error Logs:

    pic001.jpg

    This is due to me adding the following code to the session.php file:

    PHP:
    $my_style $_COOKIE["style"];
    What would be the best way to avoid getting the server error logs? My code is working perfectly.

    Thank you.
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    PHP:
    $my_style XenForo_Application::get('options')->defaultStyleId;

    if(isset(
    $_COOKIE['style'])) {
      
    $my_style $_COOKIE['style'];
    }
    Its a good rule of thumb to always verify an index exists before accessing it.
     
  3. AndyB

    AndyB Well-Known Member

    Hi King Kovifor,

    Thank you so much for helping.

    It turned out that replacing the line:

    $my_style = $_COOKIE["style"];

    with

    $my_style = $request->getCookie('style');

    solved my problem with the server error logs.
     

Share This Page