@@ -22,25 +22,47 @@ protected function setUp(): void
2222 $ class = new ReflectionClass (Session::class);
2323 $ propHasStarted = $ class ->getProperty ('hasStarted ' );
2424 $ propHasStarted ->setAccessible (true );
25- $ propHasStarted ->setValue (false );
25+ if (\PHP_MAJOR_VERSION === 8 && \PHP_MINOR_VERSION >= 3 ) {
26+ $ class ->setStaticPropertyValue ('hasStarted ' , false );
27+ } else {
28+ $ propHasStarted ->setValue (false );
29+ }
2630
2731 $ propDriver = $ class ->getProperty ('driver ' );
2832 $ propDriver ->setAccessible (true );
29- $ propDriver ->setValue (null );
33+ if (\PHP_MAJOR_VERSION === 8 && \PHP_MINOR_VERSION >= 3 ) {
34+ $ class ->setStaticPropertyValue ('driver ' , null );
35+ } else {
36+ $ propDriver ->setValue (null );
37+ }
3038
3139 $ propHasChanged = $ class ->getProperty ('hasChanged ' );
3240 $ propHasChanged ->setAccessible (true );
33- $ propHasChanged ->setValue (true );
41+ if (\PHP_MAJOR_VERSION === 8 && \PHP_MINOR_VERSION >= 3 ) {
42+ $ class ->setStaticPropertyValue ('hasChanged ' , true );
43+ } else {
44+ $ propHasChanged ->setValue (true );
45+ }
3446
3547 $ propOptions = $ class ->getProperty ('options ' );
3648 $ propOptions ->setAccessible (true );
37- $ propOptions ->setValue ([
38- 'read_and_close ' => true ,
39- 'cookie_httponly ' => '1 ' ,
40- 'use_only_cookies ' => '1 ' ,
41- 'use_trans_sid ' => '0 ' ,
42- 'use_strict_mode ' => '1 '
43- ]);
49+ if (\PHP_MAJOR_VERSION === 8 && \PHP_MINOR_VERSION >= 3 ) {
50+ $ class ->setStaticPropertyValue ('options ' , [
51+ 'read_and_close ' => true ,
52+ 'cookie_httponly ' => '1 ' ,
53+ 'use_only_cookies ' => '1 ' ,
54+ 'use_trans_sid ' => '0 ' ,
55+ 'use_strict_mode ' => '1 '
56+ ]);
57+ } else {
58+ $ propOptions ->setValue ([
59+ 'read_and_close ' => true ,
60+ 'cookie_httponly ' => '1 ' ,
61+ 'use_only_cookies ' => '1 ' ,
62+ 'use_trans_sid ' => '0 ' ,
63+ 'use_strict_mode ' => '1 '
64+ ]);
65+ }
4466
4567 $ path = \ini_get ('session.save_path ' );
4668 if (empty ($ path )) {
0 commit comments