Problem with PHP5, CGI and Session

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm expiriencing a problem when I use my application with PHP5 as a CGI module (this is due to my provider). I've developed and tested the application on two servers, both using PHP5 as module, without problems.

It seems that the session gets malformed somehow during the first reuqest.

1) On the first request, the session itself is empty:
array(0) { }

2) On the second request, using session cookies, I see the initialized session array:
array(1) { ["fru"]=>  &array(1) { ["cache"]=>  array(0) { } } }

But only as long as I'm in my applications constructor.
But as soon as my class' constructor returns, the session suddenly contains another value:

object(Application)#1 (4) {
 ["db:protected"]=>
 object(TsMySQLConnection)#2 (4) {
   ["conRes:private"]=>
[......]


The simplified code-flow is:

session.php
	class MySession {
		function __construct() {
			session_start();
			$_SESSION['app']['cache'] = array();
		}
	}

application.php

	class Application {
		protected $session;
		function __construct() {
			$this->session = new MySession();
		}
	}


index.php require_once 'application.php';

	$app = new Application;
	# here, var_dump($_SESSION['fru']) outputs suddenly the Application-class, instead of the empty array
	$app->main();


I'm unable to find out the problem. It seems that after return from the constructor the _SESSION is messed up and contains the object which I just created newly.

Anyone expiriencing similiar problems?

regards,
- Markus

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux