Issues (36)

src/Resources/dev-router.php (1 issue)

Labels
Severity
1
<?php declare(strict_types=1);
2
3
/*
4
 * This file is part of Biurad opensource projects.
5
 *
6
 * @copyright 2019 Biurad Group (https://biurad.com/)
7
 * @license   https://opensource.org/licenses/BSD-3-Clause License
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
// Workaround https://bugs.php.net/64566
14
if (\ini_get('auto_prepend_file') && !\in_array(\realpath(\ini_get('auto_prepend_file')), \get_included_files(), true)) {
15
    require \ini_get('auto_prepend_file');
16
}
17
18
if (\is_file($_SERVER['DOCUMENT_ROOT'].\DIRECTORY_SEPARATOR.$_SERVER['SCRIPT_NAME'])) {
19
    return false;
20
}
21
22
$script = $_ENV['APP_FRONT_CONTROLLER'] ?? 'index.php';
23
24
$_SERVER = \array_merge($_SERVER, $_ENV);
25
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].\DIRECTORY_SEPARATOR.$script;
26
27
// Since we are rewriting to app_dev.php, adjust SCRIPT_NAME and PHP_SELF accordingly
28
$_SERVER['SCRIPT_NAME'] = \DIRECTORY_SEPARATOR.$script;
29
$_SERVER['PHP_SELF'] = \DIRECTORY_SEPARATOR.$script;
30
31
require $script;
32
33
\error_log(\sprintf('%s:%d [%d]: %s', $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_PORT'], \http_response_code(), $_SERVER['REQUEST_URI']), 4);
0 ignored issues
show
It seems like http_response_code() can also be of type true; however, parameter $values of sprintf() does only seem to accept double|integer|string, maybe add an additional type check? ( Ignorable by Annotation )

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

33
\error_log(\sprintf('%s:%d [%d]: %s', $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_PORT'], /** @scrutinizer ignore-type */ \http_response_code(), $_SERVER['REQUEST_URI']), 4);
Loading history...
34