Issues (575)

Security Analysis    not enabled

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.

tests/php/PHPMD/RuleTest.php (2 issues)

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
 * This file is part of PHP Mess Detector.
4
 *
5
 * Copyright (c) Manuel Pichler <[email protected]>.
6
 * All rights reserved.
7
 *
8
 * Licensed under BSD License
9
 * For full copyright and license information, please see the LICENSE file.
10
 * Redistributions of files must retain the above copyright notice.
11
 *
12
 * @author Manuel Pichler <[email protected]>
13
 * @copyright Manuel Pichler. All rights reserved.
14
 * @license https://opensource.org/licenses/bsd-license.php BSD License
15
 * @link http://phpmd.org/
16
 */
17
18
namespace PHPMD;
19
20
/**
21
 * Test case for the {@link \PHPMD\AbstractRule} class.
22
 *
23
 * @covers \PHPMD\AbstractRule
24
 */
25
class RuleTest extends AbstractTest
26
{
27
    /**
28
     * testGetIntPropertyReturnsValueOfTypeInteger
29
     *
30
     * @return void
31
     */
32 View Code Duplication
    public function testGetIntPropertyReturnsValueOfTypeInteger()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
33
    {
34
        $rule = $this->getMockForAbstractClass(\PHPMD\AbstractRule::class);
35
        $rule->addProperty(__FUNCTION__, '42.3');
36
37
        $this->assertSame(42, $rule->getIntProperty(__FUNCTION__));
38
    }
39
40
    /**
41
     * testGetBooleanPropertyReturnsTrueForStringValue1
42
     *
43
     * @return void
44
     */
45
    public function testGetBooleanPropertyReturnsTrueForStringValue1()
46
    {
47
        $rule = $this->getMockForAbstractClass(\PHPMD\AbstractRule::class);
48
        $rule->addProperty(__FUNCTION__, '1');
49
50
        $this->assertTrue($rule->getBooleanProperty(__FUNCTION__));
51
    }
52
53
    /**
54
     * testGetBooleanPropertyReturnsTrueForStringValueOn
55
     *
56
     * @return void
57
     */
58
    public function testGetBooleanPropertyReturnsTrueForStringValueOn()
59
    {
60
        $rule = $this->getMockForAbstractClass(\PHPMD\AbstractRule::class);
61
        $rule->addProperty(__FUNCTION__, 'on');
62
63
        $this->assertTrue($rule->getBooleanProperty(__FUNCTION__));
64
    }
65
66
    /**
67
     * testGetBooleanPropertyReturnsTrueForStringValueTrue
68
     *
69
     * @return void
70
     */
71
    public function testGetBooleanPropertyReturnsTrueForStringValueTrue()
72
    {
73
        $rule = $this->getMockForAbstractClass(\PHPMD\AbstractRule::class);
74
        $rule->addProperty(__FUNCTION__, 'true');
75
76
        $this->assertTrue($rule->getBooleanProperty(__FUNCTION__));
77
    }
78
79
    /**
80
     * testGetBooleanPropertyReturnsTrueForDifferentStringValue
81
     *
82
     * @return void
83
     */
84
    public function testGetBooleanPropertyReturnsTrueForDifferentStringValue()
85
    {
86
        $rule = $this->getMockForAbstractClass(\PHPMD\AbstractRule::class);
87
        $rule->addProperty(__FUNCTION__, 'True');
88
89
        $this->assertFalse($rule->getBooleanProperty(__FUNCTION__));
90
    }
91
92
    /**
93
     * testGetIntPropertyThrowsExceptionWhenNoPropertyForNameExists
94
     *
95
     * @return void
96
     * @expectedException \OutOfBoundsException
97
     */
98
    public function testGetIntPropertyThrowsExceptionWhenNoPropertyForNameExists()
99
    {
100
        $rule = $this->getMockForAbstractClass(\PHPMD\AbstractRule::class);
101
        $rule->getIntProperty(__FUNCTION__);
102
    }
103
104
    /**
105
     * testGetBooleanPropertyThrowsExceptionWhenNoPropertyForNameExists
106
     *
107
     * @return void
108
     * @expectedException \OutOfBoundsException
109
     */
110
    public function testGetBooleanPropertyThrowsExceptionWhenNoPropertyForNameExists()
111
    {
112
        $rule = $this->getMockForAbstractClass(\PHPMD\AbstractRule::class);
113
        $rule->getBooleanProperty(__FUNCTION__);
114
    }
115
116
    /**
117
     * testStringPropertyThrowsExceptionWhenNoPropertyForNameExists
118
     *
119
     * @return void
120
     * @expectedException \OutOfBoundsException
121
     */
122
    public function testGetStringPropertyThrowsExceptionWhenNoPropertyForNameExists()
123
    {
124
        $rule = $this->getMockForAbstractClass(\PHPMD\AbstractRule::class);
125
        $rule->getStringProperty(__FUNCTION__);
126
    }
127
128
    /**
129
     * testGetStringPropertyReturnsStringValue
130
     *
131
     * @return void
132
     */
133 View Code Duplication
    public function testGetStringPropertyReturnsString()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
134
    {
135
        $rule = $this->getMockForAbstractClass(\PHPMD\AbstractRule::class);
136
        $rule->addProperty(__FUNCTION__, 'Fourty Two');
137
138
        $this->assertSame('Fourty Two', $rule->getStringProperty(__FUNCTION__));
139
    }
140
}
141