Ask a Question related to PHP Bugs, Design and Development.
-
thbley at gmail dot com #1
#39619 [NEW]: custom session save handler looses current directory
From: thbley at gmail dot com
Operating system: WinXP SP2
PHP version: 5.2.0
PHP Bug Type: *General Issues
Bug description: custom session save handler looses current directory
Description:
------------
I'm using a custom session save handler. When the write function is
called, the current directory is changed to the apache bin directory. This
breaks when using relative paths for storing session data.
Reproduce code:
---------------
session_set_save_handler("none","none","read","wri te","none","none");
session_start();
echo "2 ".getcwd()."<br>";
function none() {
return true;
}
function read($id) {
echo "1 ".getcwd()."<br>";
}
function write($id,$val) {
echo "3 ".getcwd()."<br>";
}
Expected result:
----------------
1 H:\sgs\src
Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at
H:\sgs\src\test_session.php:14) in H:\sgs\src\test_session.php on line 5
2 H:\sgs\src
3 H:\sgs\src
Actual result:
--------------
1 H:\sgs\src
Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at
H:\sgs\src\test_session.php:14) in H:\sgs\src\test_session.php on line 5
2 H:\sgs\src
3 H:\Development\Apache2_php5\bin
--
Edit bug report at [url]http://bugs.php.net/?id=39619&edit=1[/url]
--
Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=39619&r=trysnapshot44[/url]
Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=39619&r=trysnapshot52[/url]
Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=39619&r=trysnapshot60[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=39619&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=39619&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=39619&r=needtrace[/url]
Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=39619&r=needscript[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=39619&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=39619&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=39619&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=39619&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=39619&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=39619&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=39619&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=39619&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=39619&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=39619&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=39619&r=float[/url]
No Zend Extensions: [url]http://bugs.php.net/fix.php?id=39619&r=nozend[/url]
MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=39619&r=mysqlcfg[/url]
thbley at gmail dot com Guest
-
#32330 [Com]: session_destroy, "Failed to initialize storage module", custom session handler
ID: 32330 Comment by: faithfulsoft at tiscali dot it Reported By: mfischer@php.net Status: Open Bug Type: ... -
Custom session handler problems
I am using sessions on a load balanced server and have no access to /tmp I have been trying to use a MySQL custom session handler as a work around... -
[PHP-DEV] Custom PHP session handler (MS SQL) and register_shutdown_function()?]
-------- Original Message -------- Subject: RE: Custom PHP session handler (MS SQL) and register_shutdown_function()? Date: Thu, 14 Aug 2003... -
note 20666 deleted from function.session-set-save-handler by sniper
Note Submitter: pete@mdsc.com ---- Undocumented is the fact that you can use object methods as your session save handlers. This works with PHP... -
note 33765 added to function.session-set-save-handler
in reply to myself... (05-Jun-2003 09:09) well. you DO get the whole session info on _read() if you do actually _write the info.. and dont... -
tony2001@php.net #2
#39619 [Opn->Fbk]: custom session save handler looses current directory
ID: 39619
Updated by: [email]tony2001@php.net[/email]
Reported By: thbley at gmail dot com
-Status: Open
+Status: Feedback
-Bug Type: *General Issues
+Bug Type: Session related
Operating System: WinXP SP2
PHP Version: 5.2.0
New Comment:
Please add session_write_close() to the end of the script and see if it
works for you.
Previous Comments:
------------------------------------------------------------------------
[2006-11-24 14:59:18] thbley at gmail dot com
Description:
------------
I'm using a custom session save handler. When the write function is
called, the current directory is changed to the apache bin directory.
This breaks when using relative paths for storing session data.
Reproduce code:
---------------
session_set_save_handler("none","none","read","wri te","none","none");
session_start();
echo "2 ".getcwd()."<br>";
function none() {
return true;
}
function read($id) {
echo "1 ".getcwd()."<br>";
}
function write($id,$val) {
echo "3 ".getcwd()."<br>";
}
Expected result:
----------------
1 H:\sgs\src
Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at
H:\sgs\src\test_session.php:14) in H:\sgs\src\test_session.php on line
5
2 H:\sgs\src
3 H:\sgs\src
Actual result:
--------------
1 H:\sgs\src
Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at
H:\sgs\src\test_session.php:14) in H:\sgs\src\test_session.php on line
5
2 H:\sgs\src
3 H:\Development\Apache2_php5\bin
------------------------------------------------------------------------
--
Edit this bug report at [url]http://bugs.php.net/?id=39619&edit=1[/url]
tony2001@php.net Guest
-
thbley at gmail dot com #3
#39619 [Fbk->Opn]: custom session save handler looses current directory
ID: 39619
User updated by: thbley at gmail dot com
Reported By: thbley at gmail dot com
-Status: Feedback
+Status: Open
Bug Type: Session related
Operating System: WinXP SP2
PHP Version: 5.2.0
New Comment:
Yes adding session_write_close() works but this means I need to call it
every time I call exit(), die(), return etc. ... not very comfortable
for bigger programs.
The documentation doesn't state the directory change, see
[url]http://de.php.net/manual/en/function.session-set-save-handler.php[/url]
Previous Comments:
------------------------------------------------------------------------
[2006-11-24 15:04:41] [email]tony2001@php.net[/email]
Please add session_write_close() to the end of the script and see if it
works for you.
------------------------------------------------------------------------
[2006-11-24 14:59:18] thbley at gmail dot com
Description:
------------
I'm using a custom session save handler. When the write function is
called, the current directory is changed to the apache bin directory.
This breaks when using relative paths for storing session data.
Reproduce code:
---------------
session_set_save_handler("none","none","read","wri te","none","none");
session_start();
echo "2 ".getcwd()."<br>";
function none() {
return true;
}
function read($id) {
echo "1 ".getcwd()."<br>";
}
function write($id,$val) {
echo "3 ".getcwd()."<br>";
}
Expected result:
----------------
1 H:\sgs\src
Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at
H:\sgs\src\test_session.php:14) in H:\sgs\src\test_session.php on line
5
2 H:\sgs\src
3 H:\sgs\src
Actual result:
--------------
1 H:\sgs\src
Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at
H:\sgs\src\test_session.php:14) in H:\sgs\src\test_session.php on line
5
2 H:\sgs\src
3 H:\Development\Apache2_php5\bin
------------------------------------------------------------------------
--
Edit this bug report at [url]http://bugs.php.net/?id=39619&edit=1[/url]
thbley at gmail dot com Guest
-
tony2001@php.net #4
#39619 [Opn->Bgs]: custom session save handler looses current directory
ID: 39619
Updated by: [email]tony2001@php.net[/email]
Reported By: thbley at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Session related
Operating System: WinXP SP2
PHP Version: 5.2.0
New Comment:
The fact that ext/session is affected by shutdown order sequence is a
known problem, but unfortunately noone is willing to rewrite
ext/session from scratch, which is most likely required to get this
problem fixed.
Previous Comments:
------------------------------------------------------------------------
[2006-11-24 15:13:04] thbley at gmail dot com
Yes adding session_write_close() works but this means I need to call it
every time I call exit(), die(), return etc. ... not very comfortable
for bigger programs.
The documentation doesn't state the directory change, see
[url]http://de.php.net/manual/en/function.session-set-save-handler.php[/url]
------------------------------------------------------------------------
[2006-11-24 15:04:41] [email]tony2001@php.net[/email]
Please add session_write_close() to the end of the script and see if it
works for you.
------------------------------------------------------------------------
[2006-11-24 14:59:18] thbley at gmail dot com
Description:
------------
I'm using a custom session save handler. When the write function is
called, the current directory is changed to the apache bin directory.
This breaks when using relative paths for storing session data.
Reproduce code:
---------------
session_set_save_handler("none","none","read","wri te","none","none");
session_start();
echo "2 ".getcwd()."<br>";
function none() {
return true;
}
function read($id) {
echo "1 ".getcwd()."<br>";
}
function write($id,$val) {
echo "3 ".getcwd()."<br>";
}
Expected result:
----------------
1 H:\sgs\src
Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at
H:\sgs\src\test_session.php:14) in H:\sgs\src\test_session.php on line
5
2 H:\sgs\src
3 H:\sgs\src
Actual result:
--------------
1 H:\sgs\src
Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at
H:\sgs\src\test_session.php:14) in H:\sgs\src\test_session.php on line
5
2 H:\sgs\src
3 H:\Development\Apache2_php5\bin
------------------------------------------------------------------------
--
Edit this bug report at [url]http://bugs.php.net/?id=39619&edit=1[/url]
tony2001@php.net Guest
-
thbley at gmail dot com #5
#39619 [Bgs->Opn]: custom session save handler looses current directory
ID: 39619
User updated by: thbley at gmail dot com
Reported By: thbley at gmail dot com
-Status: Bogus
+Status: Open
Bug Type: Session related
Operating System: WinXP SP2
PHP Version: 5.2.0
New Comment:
So can you update the documentation on
[url]http://www.php.net/manual/en/function.session-set-save-handler.php[/url] ? I
think this would save the people a lot of time if they know that they
have to use absolute paths here.
Previous Comments:
------------------------------------------------------------------------
[2006-11-24 15:20:01] [email]tony2001@php.net[/email]
The fact that ext/session is affected by shutdown order sequence is a
known problem, but unfortunately noone is willing to rewrite
ext/session from scratch, which is most likely required to get this
problem fixed.
------------------------------------------------------------------------
[2006-11-24 15:13:04] thbley at gmail dot com
Yes adding session_write_close() works but this means I need to call it
every time I call exit(), die(), return etc. ... not very comfortable
for bigger programs.
The documentation doesn't state the directory change, see
[url]http://de.php.net/manual/en/function.session-set-save-handler.php[/url]
------------------------------------------------------------------------
[2006-11-24 15:04:41] [email]tony2001@php.net[/email]
Please add session_write_close() to the end of the script and see if it
works for you.
------------------------------------------------------------------------
[2006-11-24 14:59:18] thbley at gmail dot com
Description:
------------
I'm using a custom session save handler. When the write function is
called, the current directory is changed to the apache bin directory.
This breaks when using relative paths for storing session data.
Reproduce code:
---------------
session_set_save_handler("none","none","read","wri te","none","none");
session_start();
echo "2 ".getcwd()."<br>";
function none() {
return true;
}
function read($id) {
echo "1 ".getcwd()."<br>";
}
function write($id,$val) {
echo "3 ".getcwd()."<br>";
}
Expected result:
----------------
1 H:\sgs\src
Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at
H:\sgs\src\test_session.php:14) in H:\sgs\src\test_session.php on line
5
2 H:\sgs\src
3 H:\sgs\src
Actual result:
--------------
1 H:\sgs\src
Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at
H:\sgs\src\test_session.php:14) in H:\sgs\src\test_session.php on line
5
2 H:\sgs\src
3 H:\Development\Apache2_php5\bin
------------------------------------------------------------------------
--
Edit this bug report at [url]http://bugs.php.net/?id=39619&edit=1[/url]
thbley at gmail dot com Guest



Reply With Quote

