PHP  
 PHP_7_2
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Expected Test Failure Report for ext/session/tests/bug71162.phpt ('updateTimestamp never called when session data is empty')

Script

1: <?php
2:
class MySessionHandler extends SessionHandler implements SessionUpdateTimestampHandlerInterface
3:
{
4:     public function 
open($path$sessname) {
5:         return 
TRUE;
6:     }
7:
8:     public function 
close() {
9:         return 
TRUE;
10:     }
11:
12:     public function 
read($sessid) {
13:         return 
'';
14:     }
15:
16:     public function 
write($sessid$sessdata) {
17:         echo 
__FUNCTION__PHP_EOL;
18:         return 
TRUE;
19:     }
20:
21:     public function 
destroy($sessid) {
22:         return 
TRUE;
23:     }
24:
25:     public function 
gc($maxlifetime) {
26:         return 
TRUE;
27:     }
28:
29:     public function 
create_sid() {
30:         return 
sha1(random_bytes(32));
31:     }
32:
33:     public function 
validateId($sid) {
34:         return 
TRUE;
35:     }
36:
37:     public function 
updateTimestamp($sessid$sessdata) {
38:         echo 
__FUNCTION__PHP_EOL;
39:         return 
TRUE;
40:     }
41: }
42:
43:
ob_start();
44:
$handler = new MySessionHandler();
45:
session_set_save_handler($handler);
46:
47:
session_id(sha1(''));
48:
var_dump(session_id());
49:
var_dump(session_start(['lazy_write'=>1]));
50:
session_commit();
51:
52:
session_id(sha1(''));
53:
var_dump(session_id());
54:
var_dump(session_start(['lazy_write'=>1]));
55:
session_commit();
56:
57:
session_id(sha1(''));
58:
var_dump(session_id());
59:
var_dump(session_start(['lazy_write'=>0]));
60:
session_commit();
61:
?>
62:

Expected

string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
bool(true)
write
string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
bool(true)
updateTimestamp
string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
bool(true)
write

Output

string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
bool(true)
write
string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
bool(true)
write
string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
bool(true)
write

Diff

006+ write
006- updateTimestamp

 

Generated at Sat, 09 Dec 2017 10:21:20 +0000 (2 days ago)

Copyright © 2005-2017 The PHP Group
All rights reserved.