#39619 [NEW]: custom session save handler looses current directory

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #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

  2. Similar Questions and Discussions

    1. #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: ...
    2. 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...
    3. [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...
    4. 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...
    5. 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...
  3. #2

    Default #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

  4. #3

    Default #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

  5. #4

    Default #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

  6. #5

    Default #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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139