Issues (195)

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.

Risoluto/UrlTest/UrlTest4RedirectTo.php (11 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
 * UrlTest4RedirectTo
4
 *
5
 * Url::RedirectTo用テストケース
6
 *
7
 * @package           risoluto
8
 * @author            Risoluto Developers
9
 * @license           http://opensource.org/licenses/bsd-license.php new BSD license
10
 * @copyright     (C) 2008-2015 Risoluto Developers / All Rights Reserved.
11
 */
12
13
//------------------------------------------------------//
14
// 名前空間の定義
15
//------------------------------------------------------//
16
namespace Risoluto;
17
18
//------------------------------------------------------//
19
// テストクラス定義
20
//------------------------------------------------------//
21
/**
22
 * @runTestsInSeparateProcesses
23
 */
24
class UrlTest4RedirectTo extends \PHPUnit_Framework_TestCase
25
{
26
    //------------------------------------------------------//
27
    // テストプロパティ定義
28
    //------------------------------------------------------//
29
    private static $default_server = [ 'HTTP_HOST' => 'localhost', 'SERVER_PORT' => '80', 'PHP_SELF' => '/' ];
30
31
    //------------------------------------------------------//
32
    // テストメソッド定義
33
    //------------------------------------------------------//
34
    /**
35
     * setUp()
36
     *
37
     * テストに必要な準備を実施
38
     */
39
    protected function setUp()
40
    {
41
        // 拡張モジュールがロードされているかをチェック
42
        if (!extension_loaded( 'xdebug' )) {
43
            $this->markTestSkipped( 'Cannot use xdebug expansion module.' );
44
        }
45
    }
46
47
    /**
48
     * test_RedirectTo_WithoutArgs()
49
     *
50
     * redirectTo()の挙動をテストする(引数無し)
51
     *
52
     */
53
    public function test_RedirectTo_WithoutArgs()
54
    {
55
        Url::redirectTo( null, [ ], null, self::$default_server );
56
        $output_header = xdebug_get_headers();
57
58
        $this->assertContains( 'Location: http://localhost/', $output_header );
59
    }
60
61
    /**
62
     * test_RedirectTo_WithTarget()
63
     *
64
     * redirectTo()の挙動をテストする(targetのみ指定)
65
     *
66
     */
67 View Code Duplication
    public function test_RedirectTo_WithTarget()
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...
68
    {
69
        Url::redirectTo( 'Top', [ ], null, self::$default_server );
70
        $output_header = xdebug_get_headers();
71
72
        $this->assertContains( 'Location: http://localhost/?seq=Top', $output_header );
73
    }
74
75
    /**
76
     * test_RedirectTo_WithTargetAndParam1()
77
     *
78
     * redirectTo()の挙動をテストする(targetとparamのみ指定その1)
79
     *
80
     */
81 View Code Duplication
    public function test_RedirectTo_WithTargetAndParam1()
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...
82
    {
83
        Url::redirectTo( 'Top', [ 'Foo' => '' ], null, self::$default_server );
84
        $output_header = xdebug_get_headers();
85
86
        $this->assertContains( 'Location: http://localhost/?seq=Top.Foo', $output_header );
87
    }
88
89
    /**
90
     * test_RedirectTo_WithTargetAndParam2()
91
     *
92
     * redirectTo()の挙動をテストする(targetとparamのみ指定その2)
93
     *
94
     */
95 View Code Duplication
    public function test_RedirectTo_WithTargetAndParam2()
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...
96
    {
97
        Url::redirectTo( 'Top', [ 'Foo' => 'Bar' ], null, self::$default_server );
98
        $output_header = xdebug_get_headers();
99
100
        $this->assertContains( 'Location: http://localhost/?seq=Top.Foo=Bar', $output_header );
101
    }
102
103
    /**
104
     * test_RedirectTo_WithTargetAndParam3()
105
     *
106
     * redirectTo()の挙動をテストする(targetとparamのみ指定その3)
107
     *
108
     */
109 View Code Duplication
    public function test_RedirectTo_WithTargetAndParam3()
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...
110
    {
111
        Url::redirectTo( 'Top', [ 'Foo' => 'Bar', 'Hoge' => '' ], null, self::$default_server );
112
        $output_header = xdebug_get_headers();
113
114
        $this->assertContains( 'Location: http://localhost/?seq=Top.Foo=Bar.Hoge', $output_header );
115
    }
116
117
    /**
118
     * test_RedirectTo_WithTargetAndParam4()
119
     *
120
     * redirectTo()の挙動をテストする(targetとparamのみ指定その4)
121
     *
122
     */
123 View Code Duplication
    public function test_RedirectTo_WithTargetAndParam4()
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...
124
    {
125
        Url::redirectTo( 'Top', [ 'Foo' => 'Bar', 'Hoge' => 'Fuga' ], null, self::$default_server );
126
        $output_header = xdebug_get_headers();
127
128
        $this->assertContains( 'Location: http://localhost/?seq=Top.Foo=Bar.Hoge=Fuga', $output_header );
129
    }
130
131
    /**
132
     * test_RedirectTo_WithTargetAndParam5()
133
     *
134
     * redirectTo()の挙動をテストする(targetとparamのみ指定その5)
135
     *
136
     */
137 View Code Duplication
    public function test_RedirectTo_WithTargetAndParam5()
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...
138
    {
139
        Url::redirectTo( 'Top', [ 'Hoge' => 'Fuga', 'Foo' => 'Bar' ], null, self::$default_server );
140
        $output_header = xdebug_get_headers();
141
142
        $this->assertContains( 'Location: http://localhost/?seq=Top.Foo=Bar.Hoge=Fuga', $output_header );
143
    }
144
145
    /**
146
     * test_RedirectTo_WithTargetAndParamAndStatuscode()
147
     *
148
     * redirectTo()の挙動をテストする(targetとparamとstatuscodeのみ指定)
149
     *
150
     */
151
    public function test_RedirectTo_WithTargetAndParamAndStatuscode()
152
    {
153
        Url::redirectTo( 'Top', [ 'Hoge' => 'Fuga', 'Foo' => 'Bar' ], '303', self::$default_server );
154
        $output_header = xdebug_get_headers();
155
        $this->assertContains( 'Location: http://localhost/?seq=Top.Foo=Bar.Hoge=Fuga', $output_header );
156
    }
157
158
    /**
159
     * test_RedirectTo_WithFullArgs1()
160
     *
161
     * redirectTo()の挙動をテストする(全引数を指定その1)
162
     *
163
     */
164 View Code Duplication
    public function test_RedirectTo_WithFullArgs1()
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...
165
    {
166
        Url::redirectTo( 'Top', [ 'Hoge' => 'Fuga', 'Foo' => 'Bar' ], '303',
167
            [ 'HTTP_HOST' => 'example.com', 'SERVER_PORT' => '80', 'PHP_SELF' => '/' ] );
168
        $output_header = xdebug_get_headers();
169
        $this->assertContains( 'Location: http://example.com/?seq=Top.Foo=Bar.Hoge=Fuga', $output_header );
170
    }
171
172
    /**
173
     * test_RedirectTo_WithFullArgs2()
174
     *
175
     * redirectTo()の挙動をテストする(全引数を指定その2)
176
     *
177
     */
178 View Code Duplication
    public function test_RedirectTo_WithFullArgs2()
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...
179
    {
180
        Url::redirectTo( 'Top', [ 'Hoge' => 'Fuga', 'Foo' => 'Bar' ], '303',
181
            [ 'HTTP_HOST' => 'example.com', 'SERVER_PORT' => '443', 'PHP_SELF' => '/' ] );
182
        $output_header = xdebug_get_headers();
183
        $this->assertContains( 'Location: https://example.com/?seq=Top.Foo=Bar.Hoge=Fuga', $output_header );
184
    }
185
186
    /**
187
     * test_RedirectTo_WithFullArgs3()
188
     *
189
     * redirectTo()の挙動をテストする(全引数を指定その3)
190
     *
191
     */
192 View Code Duplication
    public function test_RedirectTo_WithFullArgs3()
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...
193
    {
194
        Url::redirectTo( 'Top', [ 'Hoge' => 'Fuga', 'Foo' => 'Bar' ], '303',
195
            [ 'HTTP_HOST' => 'example.com', 'SERVER_PORT' => '8080', 'PHP_SELF' => '/' ] );
196
        $output_header = xdebug_get_headers();
197
        $this->assertContains( 'Location: http://example.com:8080/?seq=Top.Foo=Bar.Hoge=Fuga', $output_header );
198
    }
199
200
    /**
201
     * test_RedirectTo_WithFullArgs4()
202
     *
203
     * redirectTo()の挙動をテストする(全引数を指定その4)
204
     *
205
     */
206 View Code Duplication
    public function test_RedirectTo_WithFullArgs4()
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...
207
    {
208
        Url::redirectTo( 'Top', [ 'Hoge' => 'Fuga', 'Foo' => 'Bar' ], '303',
209
            [ 'HTTP_HOST' => 'example.com', 'SERVER_PORT' => '8443', 'PHP_SELF' => '/' ] );
210
        $output_header = xdebug_get_headers();
211
        $this->assertContains( 'Location: https://example.com:8443/?seq=Top.Foo=Bar.Hoge=Fuga', $output_header );
212
    }
213
214
    /**
215
     * test_RedirectTo_WithFullArgs5()
216
     *
217
     * redirectTo()の挙動をテストする(全引数を指定その5)
218
     *
219
     */
220 View Code Duplication
    public function test_RedirectTo_WithFullArgs5()
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...
221
    {
222
        Url::redirectTo( 'Top', [ 'Hoge' => 'Fuga', 'Foo' => 'Bar' ], '303',
223
            [ 'HTTP_HOST' => 'example.com', 'SERVER_PORT' => '8443', 'PHP_SELF' => '/extra/' ] );
224
        $output_header = xdebug_get_headers();
225
        $this->assertContains( 'Location: https://example.com:8443/extra/?seq=Top.Foo=Bar.Hoge=Fuga', $output_header );
226
    }
227
}