note 126563 added to function.session-set-save-handler
| From: | polygon dot co dot in at gmail dot com | Date: | Sat, 06 Nov 2021 19:39:31 +0000 |
| Subject: | note 126563 added to function.session-set-save-handler | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217151@lists.php.net to get a copy of this message | ||
Below is a demo to check the order in which session function executes.
<?php
ini_set('session.use_strict_mode',true);
function sess_open($sess_path, $sess_name) {
echo '<br/>sess_open';
return true;
}
function sess_close() {
echo '<br/>sess_close';
return true;
}
function sess_read($sess_id) {
echo '<br/>sess_read';
return '';
}
function sess_write($sess_id, $data) {
echo '<br/>sess_write';
return true;
}
function sess_destroy($sess_id) {
echo '<br/>sess_destroy';
return true;
}
function sess_gc($sess_maxlifetime) {
echo '<br/>sess_gc';
return true;
}
function sess_create_sid() {
echo '<br/>sess_create_sid';
return 'RNS'.rand(0,10);
}
function sess_validate_sid($sess_id) {
echo '<br/>sess_validate_sid';
return true;
}
function sess_update_timestamp($sess_id,$data) {
echo '<br/>sess_update_timestamp';
return true;
}
session_set_save_handler(
'sess_open',
'sess_close',
'sess_read',
'sess_write',
'sess_destroy',
'sess_gc',
'sess_create_sid',
'sess_validate_sid',
'sess_update_timestamp'
);
session_start();
echo '<br/>code here...';
?>
O/P Below when above code executed first time.
sess_open
sess_create_sid
sess_read
code here...
sess_write
sess_close
O/P Below for next execution.
sess_open
sess_validate_sid
sess_read
code here...
sess_write
sess_close
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 203.192.243.78)
----
Manual Page -- https://php.net/manual/en/function.session-set-save-handler.php
Edit -- https://main.php.net/note/edit/126563
Del: integrated -- https://main.php.net/note/delete/126563/integrated
Del: useless -- https://main.php.net/note/delete/126563/useless
Del: bad code -- https://main.php.net/note/delete/126563/bad+code
Del: spam -- https://main.php.net/note/delete/126563/spam
Del: non-english -- https://main.php.net/note/delete/126563/non-english
Del: in docs -- https://main.php.net/note/delete/126563/in+docs
Del: other reasons-- https://main.php.net/note/delete/126563
Reject -- https://main.php.net/note/reject/126563
Search -- https://main.php.net/manage/user-notes.php