Issues (1)

example/StateStorage.php (1 issue)

1
<?php
2
declare(strict_types=1);
3
4
namespace BrenoRoosevelt\OAuth2\Client\Example;
5
6
/**
7
 * Classe auxiliar para armazenar o "state" na sessão
8
 */
9
class StateStorage
10
{
11
    public function __construct()
12
    {
13
        @session_start();
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition for session_start(). This can introduce security issues, and is generally not recommended. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unhandled  annotation

13
        /** @scrutinizer ignore-unhandled */ @session_start();

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
14
    }
15
16
    public function store($v): void
17
    {
18
        $_SESSION['oauth'] = $v;
19
    }
20
21
    public function has($v): bool
22
    {
23
        return isset($_SESSION['oauth']) && $_SESSION['oauth'] === $v;
24
    }
25
26
    public function clear(): void
27
    {
28
        unset($_SESSION['oauth']);
29
    }
30
}
31