Completed
Push — master ( 7de195...5f1ca1 )
by Henry
08:39
created

includes/Bootstrap/Session.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
namespace Redaxscript\Bootstrap;
3
4
use Redaxscript\Server;
5
use function session_id;
6
use function session_regenerate_id;
7
use function session_set_cookie_params;
8
use function session_start;
9
use function session_status;
10
11
/**
12
 * children class to boot the session
13
 *
14
 * @since 3.1.0
15
 *
16
 * @package Redaxscript
17
 * @category Bootstrap
18
 * @author Henry Ruhs
19
 */
20
21
class Session extends BootstrapAbstract
22
{
23
	/**
24
	 * automate run
25
	 *
26
	 * @since 3.1.0
27
	 */
28
29 1
	public function autorun() : void
30
	{
31 1
		$protocol = new Server\Protocol($this->_request);
32 1
		session_set_cookie_params(
33
		[
34 1
			'samesite' => 'strict',
35 1
			'secure' => $protocol->getOutput() === 'https'
36
		]);
37 1
		session_start();
38 1
		$this->_request->refreshSession();
39
40
		/* session guard */
41
42 1
		if (!$this->_request->getSession('sessionGuard'))
43
		{
44 1
			$this->_request->setSession('sessionGuard', session_regenerate_id());
0 ignored issues
show
\session_regenerate_id() is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
45
		}
46 1
		$this->_registry->set('sessionId', session_id());
47 1
		$this->_registry->set('sessionStatus', session_status());
48 1
	}
49
}
50