00924: pmwiki doesn't work with php 'user' session.save_handler

Summary: pmwiki doesn't work with php 'user' session.save_handler
Created: 2007-05-20 08:23
Status: Open
Category: Bug
Assigned:
Priority: 4
Version: 2.2.0beta42
OS: debian etch stable packages

Description: Hi,

setup : pmwiki 2.2.0 beta42 with authuser and a readonly site

I try to use a third party session manager named 'sharedance' (http://sharedance.pureftpd.org) and I found that I cannot log in my wiki. Just after login, I get a blank page.

Here are the logs found in error.log : PHP Fatal error: session_start() [<a href='function.session-start'>function.session-start</a>]: Failed to initialize storage module: user

I investigated and found that the several session_start() calls made by pmwiki are the root causes of this issue.

I then tried to change session_start with if (!session_id()) session_start(); and it seemes to work better (i.e I can use sharedance as a session manager and login/logout on my pmwiki site).

Can you confirm this issue ?

2007/06/02 : found a workaround

I googled a bit around this issue and found this - rather old but still valid - page : http://bugs.php.net/bug.php?id=32330

Calling session_destroy() and session_write_close() functions seems to *disable* the user session save_handler. Reassigning session.save_handler after such a call make the trick (I tested it). I then patched pmwiki.php to call a user defined function which reassign session.save_handler each time pmwiki call session_destroy and session_write_close()

I must admit that this is not very elegant :(

jean-fabrice

Array
(
    [post_max_size] => 64M
    [$_POST keys] => 
    [$_REQUEST keys] => n
    [$_SERVER] => Array
        (
            [CONTEXT_DOCUMENT_ROOT] => /home/pmwiki/public_html
            [CONTEXT_PREFIX] => 
            [DOCUMENT_ROOT] => /home/pmwiki/public_html
            [GATEWAY_INTERFACE] => CGI/1.1
            [HTTPS] => on
            [HTTP_ACCEPT] => */*
            [HTTP_ACCEPT_ENCODING] => gzip, br, zstd, deflate
            [HTTP_HOST] => www.pmwiki.org
            [HTTP_REFERER] => https://pmwiki.org/wiki/PITS/00924
            [HTTP_USER_AGENT] => Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
            [HTTP_X_HTTPS] => 1
            [PATH] => /bin:/usr/bin
            [PHP_INI_SCAN_DIR] => /opt/cpanel/ea-php70/root/etc:/opt/cpanel/ea-php70/root/etc/php.d:.
            [QUERY_STRING] => n=PITS%2f00924
            [REDIRECT_HTTPS] => on
            [REDIRECT_QUERY_STRING] => n=PITS%2f00924
            [REDIRECT_SCRIPT_URI] => https://www.pmwiki.org/wiki/PITS/00924
            [REDIRECT_SCRIPT_URL] => /wiki/PITS/00924
            [REDIRECT_SSL_TLS_SNI] => www.pmwiki.org
            [REDIRECT_STATUS] => 200
            [REDIRECT_UNIQUE_ID] => afInTDm2UxVvuTF9SpyhKwAAAVc
            [REDIRECT_URL] => /wiki/PITS/00924
            [REMOTE_ADDR] => 216.73.216.31
            [REMOTE_PORT] => 16373
            [REQUEST_METHOD] => GET
            [REQUEST_SCHEME] => https
            [REQUEST_URI] => /wiki/PITS/00924
            [SCRIPT_FILENAME] => /home/pmwiki/public_html/index.php
            [SCRIPT_NAME] => /index.php
            [SCRIPT_URI] => https://www.pmwiki.org/wiki/PITS/00924
            [SCRIPT_URL] => /wiki/PITS/00924
            [SERVER_ADDR] => 23.254.203.248
            [SERVER_ADMIN] => webmaster@pmwiki.org
            [SERVER_NAME] => www.pmwiki.org
            [SERVER_PORT] => 443
            [SERVER_PROTOCOL] => HTTP/1.1
            [SERVER_SIGNATURE] => 
            [SERVER_SOFTWARE] => Apache
            [SSL_TLS_SNI] => www.pmwiki.org
            [TZ] => America/Los_Angeles
            [UNIQUE_ID] => afInTDm2UxVvuTF9SpyhKwAAAVc
            [PHP_SELF] => /index.php
            [REQUEST_TIME_FLOAT] => 1777477452.764
            [REQUEST_TIME] => 1777477452
            [argv] => Array
                (
                    [0] => n=PITS%2f00924
                )

            [argc] => 1
        )

)