File tree Expand file tree Collapse file tree 5 files changed +67
-28
lines changed Expand file tree Collapse file tree 5 files changed +67
-28
lines changed Original file line number Diff line number Diff line change 19
19
20
20
#define PS_SANITY_CHECK \
21
21
if (PS(session_status) != php_session_active) { \
22
- php_error_docref (NULL, E_WARNING , "Session is not active"); \
23
- RETURN_FALSE ; \
22
+ zend_throw_error (NULL, "Session is not active"); \
23
+ RETURN_THROWS() ; \
24
24
} \
25
25
if (PS(default_mod) == NULL) { \
26
26
zend_throw_error(NULL, "Cannot call default session handler"); \
Original file line number Diff line number Diff line change @@ -9,7 +9,12 @@ session.save_handler=files
9
9
<?php
10
10
ini_set ('session.save_handler ' , 'files ' );
11
11
$ x = new SessionHandler ;
12
- $ x ->gc (1 );
12
+
13
+ try {
14
+ $ x ->gc (1 );
15
+ } catch (Error $ exception ) {
16
+ echo $ exception ->getMessage () . "\n" ;
17
+ }
13
18
?>
14
- --EXPECTF --
15
- Warning: SessionHandler::gc(): Session is not active in %s on line %d
19
+ --EXPECT --
20
+ Session is not active
Original file line number Diff line number Diff line change @@ -5,7 +5,12 @@ Bug #67972: SessionHandler Invalid memory read create_sid()
5
5
--FILE--
6
6
<?php
7
7
8
- (new SessionHandler )->create_sid ();
8
+ try {
9
+ (new SessionHandler )->create_sid ();
10
+ } catch (Error $ exception ) {
11
+ echo $ exception ->getMessage () . "\n" ;
12
+ }
13
+
9
14
?>
10
- --EXPECTF --
11
- Warning: SessionHandler::create_sid(): Session is not active in %s on line %d
15
+ --EXPECT --
16
+ Session is not active
Original file line number Diff line number Diff line change @@ -12,14 +12,26 @@ $sessionName = ini_get('session.name');
12
12
13
13
// session_start(); // Uncommenting this makes it not crash when reading the session (see below), but it will not return any data.
14
14
15
- $ sh ->open ($ savePath , $ sessionName );
16
- $ sh ->write ("foo " , "bar " );
17
- var_dump ($ sh ->read ("" ));
18
- ?>
19
- --EXPECTF--
20
- Warning: SessionHandler::open(): Session is not active in %s on line 10
15
+ try {
16
+ $ sh ->open ($ savePath , $ sessionName );
17
+ } catch (Error $ exception ) {
18
+ echo $ exception ->getMessage () . "\n" ;
19
+ }
20
+
21
+ try {
22
+ $ sh ->write ("foo " , "bar " );
23
+ } catch (Error $ exception ) {
24
+ echo $ exception ->getMessage () . "\n" ;
25
+ }
21
26
22
- Warning: SessionHandler::write(): Session is not active in %s on line 11
27
+ try {
28
+ $ sh ->read ("" );
29
+ } catch (Error $ exception ) {
30
+ echo $ exception ->getMessage () . "\n" ;
31
+ }
23
32
24
- Warning: SessionHandler::read(): Session is not active in %s on line 12
25
- bool(false)
33
+ ?>
34
+ --EXPECT--
35
+ Session is not active
36
+ Session is not active
37
+ Session is not active
Original file line number Diff line number Diff line change @@ -7,20 +7,37 @@ Testing repated SessionHandler::open() calls
7
7
8
8
ini_set ('session.save_handler ' , 'files ' );
9
9
$ x = new SessionHandler ;
10
- $ x ->open ('' ,'' );
11
- $ x ->open ('' ,'' );
12
- $ x ->open ('' ,'' );
13
- $ x ->open ('' ,'' );
14
10
15
- print "Done! \n" ;
11
+ try {
12
+ $ x ->open ('' ,'' );
13
+ } catch (Error $ exception ) {
14
+ echo $ exception ->getMessage () . "\n" ;
15
+ }
16
16
17
- ?>
18
- --EXPECTF--
19
- Warning: SessionHandler::open(): Session is not active in %s on line 5
17
+ try {
18
+ $ x ->open ('' ,'' );
19
+ } catch (Error $ exception ) {
20
+ echo $ exception ->getMessage () . "\n" ;
21
+ }
20
22
21
- Warning: SessionHandler::open(): Session is not active in %s on line 6
23
+ try {
24
+ $ x ->open ('' ,'' );
25
+ } catch (Error $ exception ) {
26
+ echo $ exception ->getMessage () . "\n" ;
27
+ }
22
28
23
- Warning: SessionHandler::open(): Session is not active in %s on line 7
29
+ try {
30
+ $ x ->open ('' ,'' );
31
+ } catch (Error $ exception ) {
32
+ echo $ exception ->getMessage () . "\n" ;
33
+ }
24
34
25
- Warning: SessionHandler::open(): Session is not active in %s on line 8
35
+ print "Done! \n" ;
36
+
37
+ ?>
38
+ --EXPECTF--
39
+ Session is not active
40
+ Session is not active
41
+ Session is not active
42
+ Session is not active
26
43
Done!
You can’t perform that action at this time.
0 commit comments