Issues (14)

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.

tests/Functional/SatisfiesCopyInterfaceTest.php (1 issue)

Severity

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
 * This file is part of the Axstrad library.
5
 *
6
 * (c) Dan Kempster <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @copyright 2014-2015 Dan Kempster <[email protected]>
12
 */
13
14
namespace Axstrad\Component\Content\Tests\Functional;
15
16
use Axstrad\Component\Content\Copy;
17
use Axstrad\Component\Content\Entity;
18
use Axstrad\Component\Content\Exception\InvalidArgumentException;
19
use Axstrad\Component\Content\Model;
20
use Axstrad\Component\Content\Tests\Stubs\Traits\CopyBasedIntroductionTraitStub;
21
use Axstrad\Component\Content\Tests\Stubs\Traits\CopyTraitStub;
22
23
/**
24
 * Axstrad\Component\Content\Tests\Functional\SatisfiesCopyInterfaceTest
25
 *
26
 * @author Dan Kempster <[email protected]>
27
 * @license MIT
28
 * @package Axstrad/Content
29
 * @subpackage Tests
30
 * @group functional
31
 */
32
class SatisfiesCopyInterfaceTest extends \PHPUnit_Framework_TestCase
33
{
34
    public function fixtureProvider()
35
    {
36
        return array(
37
38
            // Traits
39
            [new CopyTraitStub()],
40
            [new CopyBasedIntroductionTraitStub()],
41
42
            // Model
43
            [new Model\Article],
44
            [new Model\ArticleIntroduction],
45
            [new Model\Copy],
46
47
            // Doctrine/ORM
48
            [new Entity\Copy],
49
            [new Entity\ArticleIntroduction()],
50
            [new Entity\Article()],
51
        );
52
    }
53
54
    public function classNameProvider()
55
    {
56
        return array(
57
            // Model
58
            ['Axstrad\Component\Content\Model\Copy'],
59
            ['Axstrad\Component\Content\Model\Article'],
60
61
            // Doctrine/ORM
62
            ['Axstrad\Component\Content\Entity\Copy'],
63
            ['Axstrad\Component\Content\Entity\Article'],
64
            ['Axstrad\Component\Content\Entity\ArticleIntroduction'],
65
        );
66
    }
67
68
    /**
69
     * @dataProvider classNameProvider
70
     * @param Copy $fixture
71
     */
72
    public function testImplementsCopyInterface($fixture)
73
    {
74
        $this->assertTrue(
75
            is_a($fixture, 'Axstrad\Component\Content\Copy', true),
76
            sprintf(
77
                '%s doesn\'t implement the %s interface',
78
                $fixture,
79
                'Axstrad\Component\Content\Copy'
80
            )
81
        );
82
    }
83
84
    /**
85
     * @dataProvider fixtureProvider
86
     * @param Copy $fixture
87
     */
88
    public function testCopyIsNullToStart($fixture)
89
    {
90
        $this->assertNull(
91
            $fixture->getCopy()
92
        );
93
    }
94
    /**
95
     * @dataProvider fixtureProvider
96
     * @param Copy $fixture
97
     */
98
    public function testCanSetCopy($fixture)
99
    {
100
        $fixture->setCopy('Some more copy.');
101
        $this->assertEquals(
102
            'Some more copy.',
103
            $fixture->getCopy()
104
        );
105
    }
106
107
    /**
108
     * @dataProvider fixtureProvider
109
     * @param Copy $fixture
110
     */
111
    public function testSetCopyReturnsSelf($fixture)
112
    {
113
        $this->assertSame(
114
            $fixture,
115
            $fixture->setCopy('foo')
116
        );
117
    }
118
119
    /**
120
     * @dataProvider fixtureProvider
121
     * @param Copy $fixture
122
     */
123
    public function testCopyIsTypeCastToString($fixture)
124
    {
125
        $fixture->setCopy(1.1);
126
        $this->assertSame(
127
            '1.1',
128
            $fixture->getCopy()
129
        );
130
    }
131
132
    /**
133
     * @dataProvider fixtureProvider
134
     * @param Copy $fixture
135
     */
136
    public function testCopyCanBeSetToNull($fixture)
137
    {
138
        $fixture->setCopy('My Copy');
139
        $fixture->setCopy(null);
140
        $this->assertNull(
141
            $fixture->getCopy()
142
        );
143
    }
144
145
    /**
146
     * @expectedException InvalidArgumentException
147
     * @dataProvider fixtureProvider
148
     * @param Copy $fixture
149
     */
150
    public function testSetCopyThrowsExceptionIfArgumentIsNotScalar($fixture)
151
    {
152
        $fixture->setCopy($this);
0 ignored issues
show
$this is of type this<Axstrad\Component\C...sfiesCopyInterfaceTest>, but the function expects a null|string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
153
    }
154
}
155