These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | use Symfony\Component\HttpFoundation\Request; |
||
4 | use Symfony\Component\Debug\Debug; |
||
5 | |||
6 | // If you don't want to setup permissions the proper way, just uncomment the following PHP line |
||
7 | // read http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup |
||
8 | // for more information |
||
9 | //umask(0000); |
||
10 | |||
11 | // This check prevents access to debug front controllers that are deployed by accident to production servers. |
||
12 | // Feel free to remove this, extend it, or make something more sophisticated. |
||
13 | if (isset($_SERVER['HTTP_CLIENT_IP']) |
||
0 ignored issues
–
show
|
|||
14 | || isset($_SERVER['HTTP_X_FORWARDED_FOR']) |
||
15 | || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server') |
||
16 | ) { |
||
17 | //header('HTTP/1.0 403 Forbidden'); |
||
18 | //exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
75% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
19 | } |
||
20 | |||
21 | /** |
||
22 | * @var Composer\Autoload\ClassLoader $loader |
||
23 | */ |
||
24 | $loader = require __DIR__.'/../app/autoload.php'; |
||
25 | Debug::enable(); |
||
26 | |||
27 | $kernel = new AppKernel('dev', true); |
||
28 | $kernel->loadClassCache(); |
||
29 | $request = Request::createFromGlobals(); |
||
30 | $response = $kernel->handle($request); |
||
31 | $response->send(); |
||
32 | $kernel->terminate($request, $response); |
||
33 |
This check looks for the bodies of
if
statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.These
if
bodies can be removed. If you have an empty if but statements in theelse
branch, consider inverting the condition.could be turned into
This is much more concise to read.