[PHP-users 20120]Re: session_regenerate_idについて

Y.Watanabe yuw @ msj.biglobe.ne.jp
2004年 1月 29日 (木) 17:28:56 JST


渡辺です。

MT wrote on 2004/01/29 17:08
with Subject: [PHP-users 20119] Re: session_regenerate_idについて

>session_start();
>echo session_id();       #1
>session_regenerate_id();
>echo session_id();       #2
>
>などとすれば、確かにsession_regenerate_id()前後でIDは変わっています。
>
>でも次回アクセスの時 #1 は #2 となり、#2はさらに新しいID となることを
>期待するものの、#1 は最初の #1 のIDのままで、#2 だけ新しいID になっています。

#実際試してみたテストスクリプトをそのまま書いてほしかった。^^;)

手元の環境では、MTさんが期待するどおりの動きになりました。
redhat linux9、php4.3.3 です。
とりあえず結果だけ。




テストスクリプト: test.php
-------------------------
<?php
session_start();
echo "#1 = " . session_id() . "<br>" ;    // #1
session_regenerate_id();
echo "#2 = " . session_id() . "<br>" ;     // #2
echo "<a href=test.php>リロードしてみよう!</a><br>";
echo "<br>";
//session設定の出力
echo "<pre>";
print_r(ini_get_all("session"));
echo "<pre>";
?> 
-------------------------

テスト方法: (1)test.phpにアクセス。
             (2)リロードしよう!をクリックしてもう一度アクセス

-------------------------
(1)をやった結果↓
-------------------------
#1 = d3f05a709b9fb302cf0c76d939d5009e
#2 = 3922fdb5be7a7117648e12e025d6fb86
リロードしてみよう!

-------------------------
(2)をやった結果↓
-------------------------
#1 = 3922fdb5be7a7117648e12e025d6fb86
#2 = 86a787bc9b85bf2117edc8b15042561e
リロードしてみよう!


-------------------------
sessionまわりの設定:
-------------------------
Array
(
    [session.auto_start] => Array
        (
            [global_value] => 0
            [local_value] => 0
            [access] => 7
        )

    [session.bug_compat_42] => Array
        (
            [global_value] => 1
            [local_value] => 1
            [access] => 7
        )

    [session.bug_compat_warn] => Array
        (
            [global_value] => 1
            [local_value] => 1
            [access] => 7
        )

    [session.cache_expire] => Array
        (
            [global_value] => 180
            [local_value] => 180
            [access] => 7
        )

    [session.cache_limiter] => Array
        (
            [global_value] => 
            [local_value] => 
            [access] => 7
        )

    [session.cookie_domain] => Array
        (
            [global_value] => 
            [local_value] => 
            [access] => 7
        )

    [session.cookie_lifetime] => Array
        (
            [global_value] => 31536000
            [local_value] => 31536000
            [access] => 7
        )

    [session.cookie_path] => Array
        (
            [global_value] => /
            [local_value] => /
            [access] => 7
        )

    [session.cookie_secure] => Array
        (
            [global_value] => 
            [local_value] => 
            [access] => 7
        )

    [session.entropy_file] => Array
        (
            [global_value] => 
            [local_value] => 
            [access] => 7
        )

    [session.entropy_length] => Array
        (
            [global_value] => 0
            [local_value] => 0
            [access] => 7
        )

    [session.gc_divisor] => Array
        (
            [global_value] => 100
            [local_value] => 100
            [access] => 7
        )

    [session.gc_maxlifetime] => Array
        (
            [global_value] => 7776000
            [local_value] => 7776000
            [access] => 7
        )

    [session.gc_probability] => Array
        (
            [global_value] => 1
            [local_value] => 1
            [access] => 7
        )

    [session.name] => Array
        (
            [global_value] => PHPSESSION
            [local_value] => PHPSESSION
            [access] => 7
        )

    [session.referer_check] => Array
        (
            [global_value] => 
            [local_value] => 
            [access] => 7
        )

    [session.save_handler] => Array
        (
            [global_value] => files
            [local_value] => files
            [access] => 7
        )

    [session.save_path] => Array
        (
            [global_value] => /tmp
            [local_value] => /tmp
            [access] => 7
        )

    [session.serialize_handler] => Array
        (
            [global_value] => php
            [local_value] => php
            [access] => 7
        )

    [session.use_cookies] => Array
        (
            [global_value] => 1
            [local_value] => 1
            [access] => 7
        )

    [session.use_only_cookies] => Array
        (
            [global_value] => 1
            [local_value] => 1
            [access] => 7
        )

    [session.use_trans_sid] => Array
        (
            [global_value] => 0
            [local_value] => 0
            [access] => 6
        )

)
 







PHP-users メーリングリストの案内