Issues (387)

Branch: develop

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/phpDocumentor/Application.php (1 issue)

Flag comparisons that always yield the same result

Bug Unused Code Major

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
declare(strict_types=1);
3
4
/**
5
 * This file is part of phpDocumentor.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @author    Mike van Riel <[email protected]>
11
 * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
12
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
13
 * @link      http://phpdoc.org
14
 */
15
16
namespace phpDocumentor;
17
18
use phpDocumentor\Event\Dispatcher;
19
use phpDocumentor\Parser\Event\PreFileEvent;
20
use Psr\Log\LoggerInterface;
21
use Psr\Log\LogLevel;
22
use RuntimeException;
23
use Symfony\Component\DependencyInjection\ContainerInterface;
24
25
/**
26
 * Application class for phpDocumentor.
27
 *
28
 * Can be used as bootstrap when the run method is not invoked.
29
 *
30
 * @codeCoverageIgnore too many side-effects and system calls to properly test
31
 */
32
class Application
33
{
34
    public static function VERSION(): string
35
    {
36
        return trim(file_get_contents(__DIR__ . '/../../VERSION'));
37
    }
38
39
    public static function templateDirectory(): string
40
    {
41
        $templateDir = __DIR__ . '/../../data/templates';
42
43
        // when installed using composer the templates are in a different folder
44
        $composerTemplatePath = __DIR__ . '/../../../templates';
45
        if (file_exists($composerTemplatePath)) {
46
            $templateDir = $composerTemplatePath;
47
        }
48
49
        return $templateDir;
50
    }
51
52
    /**
53
     * Initializes all components used by phpDocumentor.
54
     */
55
    public function __construct(LoggerInterface $logger)
56
    {
57
        $this->defineIniSettings();
58
59
        Dispatcher::getInstance()->addListener(
60
            'parser.file.pre',
61
            function (PreFileEvent $event) use ($logger) {
62
                $logger->log(LogLevel::NOTICE, 'Parsing ' . $event->getFile());
63
            }
64
        );
65
    }
66
67
    /**
68
     * Adjust php.ini settings.
69
     *
70
     * @throws RuntimeException
71
     */
72
    protected function defineIniSettings(): void
73
    {
74
        $this->setTimezone();
75
        ini_set('memory_limit', '-1');
76
77
        if (extension_loaded('Zend OPcache') && ini_get('opcache.enable') && ini_get('opcache.enable_cli')) {
78
            if (ini_get('opcache.save_comments')) {
79
                ini_set('opcache.load_comments', '1');
80
            } else {
81
                ini_set('opcache.enable', '0');
82
            }
83
        }
84
85
        if (extension_loaded('Zend Optimizer+') && ini_get('zend_optimizerplus.save_comments') === 0) {
0 ignored issues
show
Unused Code Bug introduced by
The strict comparison === seems to always evaluate to false as the types of ini_get('zend_optimizerplus.save_comments') (string) and 0 (integer) can never be identical. Maybe you want to use a loose comparison == instead?
Loading history...
86
            throw new RuntimeException('Please enable zend_optimizerplus.save_comments in php.ini.');
87
        }
88
    }
89
90
    /**
91
     * If the timezone is not set anywhere, set it to UTC.
92
     *
93
     * This is done to prevent any warnings being outputted in relation to using
94
     * date/time functions.
95
     *
96
     * @link http://php.net/manual/en/function.date-default-timezone-get.php for more information how PHP determines the
97
     *     default timezone.
98
     */
99
    protected function setTimezone(): void
100
    {
101
        if (false === ini_get('date.timezone')) {
102
            date_default_timezone_set('UTC');
103
        }
104
    }
105
}
106