Completed
Push — master ( 6219f7...d44e26 )
by David
13s
created

src/UserContext/AnonymousRequestMatcher.php (1 issue)

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
3
/*
4
 * This file is part of the FOSHttpCacheBundle package.
5
 *
6
 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace FOS\HttpCacheBundle\UserContext;
13
14
use FOS\HttpCache\UserContext\AnonymousRequestMatcher as BaseAnonymousRequestMatcher;
15
16
/**
17
 * Matches anonymous requests using a list of identification headers.
18
 *
19
 * @deprecated Use AnonymousRequestMatcher of HttpCache library
20
 */
21
class AnonymousRequestMatcher extends BaseAnonymousRequestMatcher
22
{
23
    public function __construct(array $options = [])
24
    {
25
        @trigger_error(
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

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...
26
            'AnonymousRequestMatcher of HttpCacheBundle is deprecated. '.
27
            'Use AnonymousRequestMatcher of HttpCache library.',
28
            E_USER_DEPRECATED
29
        );
30
31
        if (isset($options['user_identifier_headers'], $options['session_name_prefix'])) {
32
            parent::__construct($options);
33
        } else {
34
            parent::__construct([
35
                'user_identifier_headers' => $options,
36
                'session_name_prefix' => 'PHPSESSID',
37
            ]);
38
        }
39
    }
40
}
41