소스 검색

sqsetcookie is called every time sqsession_is_active is called, which results in headers-already-sent notices after output has been initiated... here is a fix

pdontthink 17 년 전
부모
커밋
dbbbf4ce15
1개의 변경된 파일9개의 추가작업 그리고 2개의 파일을 삭제
  1. 9 2
      functions/global.php

+ 9 - 2
functions/global.php

@@ -416,12 +416,19 @@ function sqsession_start() {
     // was: @session_start();
     $session_id = session_id();
 
-    // session_starts sets the sessionid cookie buth without the httponly var
+    // session_starts sets the sessionid cookie but without the httponly var
     // setting the cookie again sets the httponly cookie attribute
-    sqsetcookie(session_name(),$session_id,false,$base_uri);
+    //
+    // need to check if headers have been sent, since sqsession_is_active()
+    // has become just a passthru to this function, so the sqsetcookie()
+    // below is called every time, even after headers have already been sent
+    //
+    if (!headers_sent())
+       sqsetcookie(session_name(),$session_id,false,$base_uri);
 }
 
 
+
 /**
  * Set a cookie
  * @param string  $sName     The name of the cookie.