So I need access to the current session from the Zend Do not ask why, I do not like to talk about it. Anyway, I've discovered that I can access it from bootstrap before starting my session. To try dragging it down and moving it I have the following code:
Secure function _initSession () {session_start (); $ Value = $ _SESSION; Session_write_close (); $ Db = Zend_Db :: Factory ('Pdo_Mysql', array ('host' = & gt; 'localhost', 'username' = & gt; 'uname', 'password' = & gt; '***** * ',' Dbname '= & gt;' dbname ')); Zend_Db_Table_Abstract :: setDefaultAdapter ($ Database); $ SessionConfig = array ('name' = & gt; 'session', 'primary' = & gt; 'sessionID', 'modified column' = & gt; 'end time', 'data column' = & gt; ',' Lifetime column '= & gt;' life span '); $ Savehandler = New Zend_Session_SaveHandler_DbTable ($ sessionConfig); Zend_Session :: setSaveHandler ($ saveHandler); Zend_Session :: Start (); $ Old = new Zend_Session_ namespace ('old'); $ Old- & gt; Value = $ value; } When this hit, it hits the code: Zend_Session :: start () , claiming that a session has already started but I have called the session_write_close () to close the session and as far as I can tell from my google-fu, there is nothing wrong in restarting the session already applied, Used to be? Is it something specific ZF? Do I have to do something else to stop the session?
You just can not do
First of all, as mentioned in The:
Do not use one of the PHP's Session-Start () functions. If you use session_start () directly, and then start using Zend_Session_Namespace, an exception will be inserted by Zend_Session :: start () ("the session has already started").
Then your code should look like this:
Zend_Session :: start (); $ Value = $ _SESSION; Zend_Session :: writeClose (); But the Zend / session. Php: 418, we have:
if (auto :: $ _ session started & self :: $ _ deleted)) {Require_once 'Zend / session / Exception.php'; Throw new Zend_Session_Exception ('During the request the session was clearly deleted, not allowed to try to restart.'); } Therefore, the way you do things is not supported by ZF (as suggested: either with two separate requests or with a batch script) .
Comments
Post a Comment