[Chameleon-dev] [Bug 685] New: Session lock not working in framed applications

bugzilla-daemon at www.maptools.org bugzilla-daemon at www.maptools.org
Mon Oct 4 15:53:56 EDT 2004


http://www.maptools.org/bugzilla/show_bug.cgi?id=685

           Summary: Session lock not working in framed applications
           Product: Chameleon
           Version: 1.99
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: chameleon-dev at lists.maptools.org
        ReportedBy: ahocevar at hotmail.com


I have a situation where Chameleon is used in a frameset, and scripts in the
other frames also access session data from the Chameleon application.

I found out that parallel read/write operations in the session directory cause
strange results.

A workaround is to use the attached patch for
chameleon/htdocs/common/session/session.php, which enables session locking when
the global variable $GLOBALS['bSessionLock'] is set to true.

Just apply the path and add

$GLOBALS['bSessionLock'] = true

at the top of your scripts.

The modified session.php uses the already implemented session locking feature,
which is used only on WIN32 platforms by original design.

--------------------------------------------
patch is against CVS version from 2004-10-04
--------------------------------------------

--- /opt/chameleon/htdocs/common/session/session.php	2004-10-04
21:48:35.683423840 +0200
+++ /opt/chameleon2/htdocs/common/session/session.php	2004-10-04
21:46:40.028006136 +0200
@@ -56,6 +56,7 @@
 
 global $gszSessSavePath;
 global $gszSessName;
+global $bLockSession;
 $bDebug = false;
 $szDebugPage = isset( $_SERVER['ORIG_PATH_TRANSLATED'] ) ? basename(
$_SERVER['ORIG_PATH_TRANSLATED'] ) : 'not set';
 $szDebugDir = "f:/ms4w/";
@@ -90,7 +91,7 @@
         mkdir($szSessionDir);
     }
 
-    if ( (PHP_OS == "WINNT" || PHP_OS == "WIN32") )
+    if ( (PHP_OS == "WINNT" || PHP_OS == "WIN32") || $GLOBALS['bLockSession'] )
     {
         $i=0;
         while ($i < ini_get("max_execution_time") - 2 ) //wait at most 2
seconds less than the execution time for the lock
@@ -132,7 +133,7 @@
     {
       debug_msg("Closed()");
     }
-    if ( (PHP_OS == "WINNT" || PHP_OS == "WIN32") )
+    if ( (PHP_OS == "WINNT" || PHP_OS == "WIN32") || $GLOBALS['bLockSession'] )
     {
         $szLockFile =
$GLOBALS['gszSessSavePath']."/sess_".$GLOBALS["gszSessId"]."/lock";
         if ($GLOBALS["bDebug"])
@@ -240,7 +241,7 @@
     {
       debug_msg("Destroy $szId");
     }
-    if ( (PHP_OS == "WINNT" || PHP_OS == "WIN32") )
+    if ( (PHP_OS == "WINNT" || PHP_OS == "WIN32") || $GLOBALS['bLockSession'] )
     {
         $szLockFile =
$GLOBALS['gszSessSavePath']."/sess_".$GLOBALS["gszSessId"]."/lock";



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


More information about the Chameleon-dev mailing list