php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5976 cannot use 'user' session module
Submitted: 2000-08-04 22:05 UTC Modified: 2000-08-20 03:06 UTC
From: marko at l-t dot ee Assigned:
Status: Closed Package: Session related
PHP Version: 4.0.1pl2 OS: Linux
Private report: No CVE-ID: None
 [2000-08-04 22:05 UTC] marko at l-t dot ee
I have a module to store session data in PostgreSQL database.
Open & read part works, the write is buggy.  In the log I get:

-- log --

<br>
<b>Warning</b>:  Failed to write session data. Please check that the current
+setting of session.save_path is correct (/tmp) in <b>Unknown</b> on line
+<b>0</b><br>
<br>

-- strace --

write(1, [ my own html ] .., 53) = 53
close(135476516)                        = -1 EBADF (Bad file descriptor)
write(1, "<br>\n<b>Warning</b>:  Failed to "..., 168) = 168

-- php with --enable-debug

<br>
<b>Warning</b>:  Failed to write session data. Please check that the current setting of session.save_path is correct (/tmp) in <b>Unknown</b> on line <b>0</b><br>
Unknown(0) : Warning - Failed to write session data. Please check that the current setting of session.save_path is correct (/tmp)
session.c(1011) :  Freeing 0x081329C4 (7 bytes), script=/usr/home/marko/public_html/stest/index.php
Last leak repeated 3 times

--

Test case and my module is available at http://195.222.18.13/php/pgsession.tgz

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-05 12:26 UTC] stas@php.net
Please try latest CVS and report if you still have problems.
 [2000-08-06 15:53 UTC] marko at l-t dot ee
No.  CVS did not compile, so I replaced 4.0.1pl2 session/ with
CVS's one and tested this.

Seems like I forgot to mention my _main_ problem. That is, session.c
uses my 'open' & 'read' to start session, but seems like it uses 'files'
'write' & 'close' to end session.  When I register my own shutdown function
that basically does

{
        my_write(session_id(), session_encode());
        my_close();
}

then everything works.  My functions log to a file so I see that my write
does not even get called.

Before I sent a mail to -general, where this was described, but seems
like this was wrong place to send it, and afterward I forgot.

---- Now --enable-debug reports:

<b>Warning</b>:  Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in <b>Unknown</b> on line <b>0</b><br>
Unknown(0) : Warning - Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp)
session.c(1036) :  Freeing 0x0815ADCC (8 bytes), script=/home/marko/public_html/pgsession/index.php
Last leak repeated 3 times


 [2000-08-14 09:30 UTC] marko at l-t dot ee
Seems like it is fixed in current CVS.

I did some digging and the problem was that after
the page was sent away but before the shutdown functions
were called (session.c's) the ini var "session.save_handler"
was reset to default.  Dunno why... If I put into
config "save_handler = user" then it was reinitialized
to "user" and it kept working.  But why the reinit?

Anyway, at the moment I do not see the bug.


 [2000-08-20 03:06 UTC] sniper@php.net
User reports bug fixed in CVS.

--Jani
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 11 08:01:27 2024 UTC