Issues (8)

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/AppserverIo/Logger/Handlers/DummyHandler.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
 * AppserverIo\Logger\Handlers\DummyHandler
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Tim Wagner <[email protected]>
15
 * @copyright 2015 TechDivision GmbH <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      http://github.com/appserver-io/logger
18
 * @link      http://www.appserver.io
19
 */
20
21
namespace AppserverIo\Logger\Handlers;
22
23
use Psr\Log\LogLevel;
24
use AppserverIo\Logger\LoggerUtils;
25
use AppserverIo\Logger\LogMessageInterface;
26
use AppserverIo\Logger\Formatters\FormatterInterface;
27
use AppserverIo\Logger\Formatters\StandardFormatter;
28
29
/**
30
 * A dummy logger implementation.
31
 *
32
 * @author    Tim Wagner <[email protected]>
33
 * @copyright 2015 TechDivision GmbH <[email protected]>
34
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
35
 * @link      http://github.com/appserver-io/logger
36
 * @link      http://www.appserver.io
37
 */
38
class DummyHandler implements HandlerInterface
39
{
40
41
    /**
42
     * The log level we want to use.
43
     *
44
     * @var string
45
     */
46
    protected $logLevel;
47
48
    /**
49
     * The available log levels.
50
     *
51
     * @var array
52
     */
53
    protected $logLevels;
54
55
    /**
56
     * The formatter instance.
57
     *
58
     * @var \AppserverIo\Logger\Formatters\FormatterInterface
59
     */
60
    protected $formatter;
61
62
    /**
63
     * Initializes the handler instance with channel name and log level.
64
     *
65
     * @param integer $logLevel The log level we want to use
66
     */
67 10
    public function __construct($logLevel = LogLevel::INFO)
68
    {
69
70
        // initialize the available log levels and formatter
71 10
        $this->logLevels = LoggerUtils::$logLevels;
72 10
        $this->formatter = new StandardFormatter();
73
74
        // set the actual log level
75 10
        $this->logLevel = $logLevel;
0 ignored issues
show
Documentation Bug introduced by
The property $logLevel was declared of type string, but $logLevel is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
76 10
    }
77
78
    /**
79
     * Sets the formatter for this handler.
80
     *
81
     * @param \AppserverIo\Logger\Formatters\FormatterInterface $formatter The formatter instance
82
     *
83
     * @return void
84
     */
85
    public function setFormatter(FormatterInterface $formatter)
86
    {
87
        $this->formatter = $formatter;
88
    }
89
90
    /**
91
     * Returns the formatter for this handler.
92
     *
93
     * @return \AppserverIo\Logger\Formatters\FormatterInterface The formatter instance
94
     */
95 6
    public function getFormatter()
96
    {
97 6
        return $this->formatter;
98
    }
99
100
    /**
101
     * Handles the log message.
102
     *
103
     * @param \AppserverIo\Logger\LogMessageInterface $logMessage The message to be handled
104
     *
105
     * @return void
106
     */
107 2
    public function handle(LogMessageInterface $logMessage)
108
    {
109
        // this is a dummy logger
110 2
    }
111
112
    /**
113
     * Returns the log level we want to use.
114
     *
115
     * @return integer The log level
116
     */
117 6
    protected function getLogLevel()
118
    {
119 6
        return $this->logLevel;
120
    }
121
122
    /**
123
     * Returns TRUE if the handler should log a message based on the actual
124
     * log level, else FALSE.
125
     *
126
     * @param string $level The log level to query
127
     *
128
     * @return boolean TRUE if the handler should log
129
     */
130 6
    protected function shouldLog($level)
131
    {
132 6
        return $this->logLevels[$level] >= $this->logLevels[$this->getLogLevel()];
133
    }
134
}
135