Issues (117)

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.

spec/Prophecy/Doubler/CachedDoublerSpec.php (6 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
namespace spec\Prophecy\Doubler;
4
5
use PhpSpec\ObjectBehavior;
6
use Prophecy\Doubler\ClassPatch\ClassPatchInterface;
7
use Prophecy\Doubler\Generator\ClassCreator;
8
use Prophecy\Doubler\Generator\ClassMirror;
9
use Prophecy\Doubler\Generator\Node\ClassNode;
10
use Prophecy\Doubler\NameGenerator;
11
12
class CachedDoublerSpec extends ObjectBehavior
13
{
14
    function let(ClassMirror $mirror, ClassCreator $creator, NameGenerator $namer)
15
    {
16
        $this->beConstructedWith($mirror, $creator, $namer);
17
        $this->resetCache();
18
    }
19
20
    /**
21
     * @todo implement
22
     * T - T
23
     * T - F
24
     * F - T
25
     * F - F
26
     * F T F
27
     * F T T
28
     */
29
30
    // T - -
31
    function it_creates_only_one_class_definition_for_the_same_class_without_interfaces_and_patches(
32
        ClassMirror $mirror,
33
        ClassCreator $creator,
34
        NameGenerator $namer,
35
        \ReflectionClass $class,
36
        ClassNode $node
37
    ) {
38
        $mirror->reflect($class, array())->willReturn($node);
39
        $namer->name($class, array())->willReturn('SplStack');
40
        $class->getName()->willReturn('stdClass');
41
42
        $creator->create('SplStack', $node)->shouldBeCalledTimes(1);
43
44
        $this->double($class, array());
45
        $this->double($class, array());
46
    }
47
48
    // F - -
49
    function it_creates_two_class_definitions_for_different_classes_without_interfaces_and_patches(
50
        ClassMirror $mirror,
51
        ClassCreator $creator,
52
        NameGenerator $namer,
53
        \ReflectionClass $class1,
54
        \ReflectionClass $class2,
55
        ClassNode $node1,
56
        ClassNode $node2
57
    ) {
58
        $mirror->reflect($class1, array())->willReturn($node1);
59
        $mirror->reflect($class2, array())->willReturn($node2);
60
        $namer->name($class1, array())->willReturn('SplStack');
61
        $namer->name($class2, array())->willReturn('spec\Prophecy\Doubler\aClass');
62
        $class1->getName()->willReturn('stdClass');
63
        $class2->getName()->willReturn('aClass');
64
65
        $creator->create('SplStack', $node1)->shouldBeCalledTimes(1);
66
        $creator->create('spec\Prophecy\Doubler\aClass', $node2)->shouldBeCalledTimes(1);
67
68
        $this->double($class1, array());
69
        $this->double($class2, array());
70
    }
71
72
    // T F T
73 View Code Duplication
    function it_creates_two_different_class_definitions_for_the_same_class_with_different_interfaces_and_same_patches(
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...
74
        ClassMirror $mirror,
75
        ClassCreator $creator,
76
        NameGenerator $namer,
77
        ClassPatchInterface $alt1,
78
        ClassPatchInterface $alt2,
79
        \ReflectionClass $class,
80
        \ReflectionClass $interface1,
81
        \ReflectionClass $interface2,
82
        ClassNode $node1,
83
        ClassNode $node2
84
    ) {
85
        $mirror->reflect($class, array($interface1))->willReturn($node1);
86
        $mirror->reflect($class, array($interface2))->willReturn($node2);
87
        $alt1->supports($node1)->willReturn(true);
88
        $alt1->supports($node2)->willReturn(true);
89
        $alt2->supports($node1)->willReturn(false);
90
        $alt2->supports($node2)->willReturn(false);
91
        $alt1->getPriority()->willReturn(1);
92
        $alt2->getPriority()->willReturn(2);
93
        $namer->name($class, array($interface1))->willReturn('SplStack');
94
        $namer->name($class, array($interface2))->willReturn('SplStack');
95
        $class->getName()->willReturn('stdClass');
96
        $interface1->getName()->willReturn('ArrayAccess');
97
        $interface2->getName()->willReturn('Iterator');
98
99
        $alt1->apply($node1)->shouldBeCalled();
100
        $alt1->apply($node2)->shouldBeCalled();
101
        $alt2->apply($node1)->shouldNotBeCalled();
102
        $alt2->apply($node2)->shouldNotBeCalled();
103
        $creator->create('SplStack', $node1)->shouldBeCalledTimes(1);
104
        $creator->create('SplStack', $node2)->shouldBeCalledTimes(1);
105
106
        $this->registerClassPatch($alt1);
107
        $this->registerClassPatch($alt2);
108
109
        $this->double($class, array($interface1));
110
        $this->double($class, array($interface2));
111
    }
112
113
    // F F T
114 View Code Duplication
    function it_creates_two_different_class_definitions_for_different_classes_with_different_interfaces_and_same_patches(
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...
115
        ClassMirror $mirror,
116
        ClassCreator $creator,
117
        NameGenerator $namer,
118
        ClassPatchInterface $alt1,
119
        ClassPatchInterface $alt2,
120
        \ReflectionClass $class1,
121
        \ReflectionClass $class2,
122
        \ReflectionClass $interface1,
123
        \ReflectionClass $interface2,
124
        ClassNode $node1,
125
        ClassNode $node2
126
    ) {
127
        $mirror->reflect($class1, array($interface1))->willReturn($node1);
128
        $mirror->reflect($class2, array($interface2))->willReturn($node2);
129
        $alt1->supports($node1)->willReturn(true);
130
        $alt1->supports($node2)->willReturn(true);
131
        $alt2->supports($node1)->willReturn(false);
132
        $alt2->supports($node2)->willReturn(false);
133
        $alt1->getPriority()->willReturn(1);
134
        $alt2->getPriority()->willReturn(2);
135
        $namer->name($class1, array($interface1))->willReturn('SplStack');
136
        $namer->name($class2, array($interface2))->willReturn('spec\Prophecy\Doubler\aClass');
137
        $class1->getName()->willReturn('stdClass');
138
        $class2->getName()->willReturn('aClass');
139
        $interface1->getName()->willReturn('ArrayAccess');
140
        $interface2->getName()->willReturn('Iterator');
141
142
        $alt1->apply($node1)->shouldBeCalled();
143
        $alt1->apply($node2)->shouldBeCalled();
144
        $alt2->apply($node1)->shouldNotBeCalled();
145
        $alt2->apply($node2)->shouldNotBeCalled();
146
        $creator->create('SplStack', $node1)->shouldBeCalledTimes(1);
147
        $creator->create('spec\Prophecy\Doubler\aClass', $node2)->shouldBeCalledTimes(1);
148
149
        $this->registerClassPatch($alt1);
150
        $this->registerClassPatch($alt2);
151
152
        $this->double($class1, array($interface1));
153
        $this->double($class2, array($interface2));
154
    }
155
156
    // T T -
157
    function it_creates_only_one_class_definition_for_the_same_class_with_same_interfaces_and_without_patches(
158
        ClassMirror $mirror,
159
        ClassCreator $creator,
160
        NameGenerator $namer,
161
        \ReflectionClass $class,
162
        \ReflectionClass $interface1,
163
        \ReflectionClass $interface2,
164
        ClassNode $node
165
    ) {
166
        $mirror->reflect($class, array($interface1, $interface2))->willReturn($node);
167
        $namer->name($class, array($interface1, $interface2))->willReturn('SplStack');
168
        $class->getName()->willReturn('stdClass');
169
        $interface1->getName()->willReturn('ArrayAccess');
170
        $interface2->getName()->willReturn('Iterator');
171
172
        $creator->create('SplStack', $node)->shouldBeCalledTimes(1);
173
174
        $this->double($class, array($interface1, $interface2));
175
        $this->double($class, array($interface1, $interface2));
176
    }
177
178
    // F T -
179
    function it_creates_only_one_class_definition_for_different_classes_with_same_interfaces_and_without_patches(
180
        ClassMirror $mirror,
181
        ClassCreator $creator,
182
        NameGenerator $namer,
183
        \ReflectionClass $class1,
184
        \ReflectionClass $class2,
185
        \ReflectionClass $interface1,
186
        \ReflectionClass $interface2,
187
        ClassNode $node1,
188
        ClassNode $node2
189
    ) {
190
        $mirror->reflect($class1, array($interface1, $interface2))->willReturn($node1);
191
        $mirror->reflect($class2, array($interface1, $interface2))->willReturn($node2);
192
        $namer->name($class1, array($interface1, $interface2))->willReturn('SplStack');
193
        $namer->name($class2, array($interface1, $interface2))->willReturn('spec\Prophecy\Doubler\aClass');
194
        $class1->getName()->willReturn('stdClass');
195
        $class2->getName()->willReturn('aClass');
196
        $interface1->getName()->willReturn('ArrayAccess');
197
        $interface2->getName()->willReturn('Iterator');
198
199
        $creator->create('SplStack', $node1)->shouldBeCalledTimes(1);
200
        $creator->create('spec\Prophecy\Doubler\aClass', $node2)->shouldBeCalledTimes(1);
201
202
        $this->double($class1, array($interface1, $interface2));
203
        $this->double($class2, array($interface1, $interface2));
204
    }
205
206
    // T F -
207 View Code Duplication
    function it_creates_two_different_class_definitions_for_the_same_class_with_different_interfaces_and_without_patches(
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...
208
        ClassMirror $mirror,
209
        ClassCreator $creator,
210
        NameGenerator $namer,
211
        \ReflectionClass $class,
212
        \ReflectionClass $interface1,
213
        \ReflectionClass $interface2,
214
        ClassNode $node1,
215
        ClassNode $node2
216
    ) {
217
        $mirror->reflect($class, array($interface1))->willReturn($node1);
218
        $mirror->reflect($class, array($interface2))->willReturn($node2);
219
        $namer->name($class, array($interface1))->willReturn('SplStack');
220
        $namer->name($class, array($interface2))->willReturn('SplStack');
221
        $class->getName()->willReturn('stdClass');
222
        $interface1->getName()->willReturn('ArrayAccess');
223
        $interface2->getName()->willReturn('Iterator');
224
225
        $creator->create('SplStack', $node1)->shouldBeCalledTimes(1);
226
        $creator->create('SplStack', $node2)->shouldBeCalledTimes(1);
227
228
        $this->double($class, array($interface1));
229
        $this->double($class, array($interface2));
230
    }
231
232
    // F F -
233 View Code Duplication
    function it_creates_two_different_class_definitions_for_different_classes_with_different_interfaces_and_without_patches(
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...
234
        ClassMirror $mirror,
235
        ClassCreator $creator,
236
        NameGenerator $namer,
237
        \ReflectionClass $class1,
238
        \ReflectionClass $class2,
239
        \ReflectionClass $interface1,
240
        \ReflectionClass $interface2,
241
        ClassNode $node1,
242
        ClassNode $node2
243
    ) {
244
        $mirror->reflect($class1, array($interface1))->willReturn($node1);
245
        $mirror->reflect($class2, array($interface2))->willReturn($node2);
246
        $namer->name($class1, array($interface1))->willReturn('SplStack');
247
        $namer->name($class2, array($interface2))->willReturn('spec\Prophecy\Doubler\aClass');
248
        $class1->getName()->willReturn('stdClass');
249
        $class2->getName()->willReturn('aClass');
250
        $interface1->getName()->willReturn('ArrayAccess');
251
        $interface2->getName()->willReturn('Iterator');
252
253
        $creator->create('SplStack', $node1)->shouldBeCalledTimes(1);
254
        $creator->create('spec\Prophecy\Doubler\aClass', $node2)->shouldBeCalledTimes(1);
255
256
        $this->double($class1, array($interface1));
257
        $this->double($class2, array($interface2));
258
    }
259
260
    // T T T
261
    function it_creates_only_one_class_definition_for_the_same_class_with_same_interfaces_and_same_patches(
262
        ClassMirror $mirror,
263
        ClassCreator $creator,
264
        NameGenerator $namer,
265
        ClassPatchInterface $alt1,
266
        ClassPatchInterface $alt2,
267
        \ReflectionClass $class,
268
        \ReflectionClass $interface1,
269
        \ReflectionClass $interface2,
270
        ClassNode $node
271
    ) {
272
        $mirror->reflect($class, array($interface1, $interface2))->willReturn($node);
273
        $alt1->supports($node)->willReturn(true);
274
        $alt2->supports($node)->willReturn(false);
275
        $alt1->getPriority()->willReturn(1);
276
        $alt2->getPriority()->willReturn(2);
277
        $namer->name($class, array($interface1, $interface2))->willReturn('SplStack');
278
        $class->getName()->willReturn('stdClass');
279
        $interface1->getName()->willReturn('ArrayAccess');
280
        $interface2->getName()->willReturn('Iterator');
281
282
        $alt1->apply($node)->shouldBeCalled();
283
        $alt2->apply($node)->shouldNotBeCalled();
284
        $creator->create('SplStack', $node)->shouldBeCalledTimes(1);
285
286
        $this->registerClassPatch($alt1);
287
        $this->registerClassPatch($alt2);
288
289
        $this->double($class, array($interface1, $interface2));
290
        $this->double($class, array($interface1, $interface2));
291
    }
292
293
    // F F F
294 View Code Duplication
    function it_creates_two_class_definitions_for_different_classes_with_different_interfaces_and_patches(
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...
295
        ClassMirror $mirror,
296
        ClassCreator $creator,
297
        NameGenerator $namer,
298
        ClassPatchInterface $alt1,
299
        ClassPatchInterface $alt2,
300
        \ReflectionClass $class1,
301
        \ReflectionClass $class2,
302
        \ReflectionClass $interface1,
303
        \ReflectionClass $interface2,
304
        ClassNode $node1,
305
        ClassNode $node2
306
    ) {
307
        $mirror->reflect($class1, array($interface1))->willReturn($node1);
308
        $mirror->reflect($class2, array($interface2))->willReturn($node2);
309
        $alt1->supports($node1)->willReturn(true);
310
        $alt1->supports($node2)->willReturn(true);
311
        $alt2->supports($node2)->willReturn(false);
312
        $alt1->getPriority()->willReturn(1);
313
        $alt2->getPriority()->willReturn(2);
314
        $namer->name($class1, array($interface1))->willReturn('SplStack');
315
        $namer->name($class2, array($interface2))->willReturn('spec\Prophecy\Doubler\aClass');
316
        $class1->getName()->willReturn('stdClass');
317
        $class2->getName()->willReturn('aClass');
318
        $interface1->getName()->willReturn('ArrayAccess');
319
        $interface2->getName()->willReturn('Iterator');
320
321
        $alt1->apply($node1)->shouldBeCalled();
322
        $alt1->apply($node2)->shouldBeCalled();
323
        $alt2->apply($node2)->shouldNotBeCalled();
324
        $creator->create('SplStack', $node1)->shouldBeCalledTimes(1);
325
        $creator->create('spec\Prophecy\Doubler\aClass', $node2)->shouldBeCalledTimes(1);
326
327
        $this->registerClassPatch($alt1);
328
        $this->double($class1, array($interface1));
329
330
        $this->registerClassPatch($alt2);
331
        $this->double($class2, array($interface2));
332
    }
333
334
    // T F F
335 View Code Duplication
    function it_creates_two_class_definitions_for_the_same_class_with_different_interfaces_and_patches(
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...
336
        ClassMirror $mirror,
337
        ClassCreator $creator,
338
        NameGenerator $namer,
339
        ClassPatchInterface $alt1,
340
        ClassPatchInterface $alt2,
341
        \ReflectionClass $class,
342
        \ReflectionClass $interface1,
343
        \ReflectionClass $interface2,
344
        ClassNode $node1,
345
        ClassNode $node2
346
    ) {
347
        $mirror->reflect($class, array($interface1))->willReturn($node1);
348
        $mirror->reflect($class, array($interface2))->willReturn($node2);
349
        $alt1->supports($node1)->willReturn(true);
350
        $alt1->supports($node2)->willReturn(true);
351
        $alt2->supports($node2)->willReturn(false);
352
        $alt1->getPriority()->willReturn(1);
353
        $alt2->getPriority()->willReturn(2);
354
        $namer->name($class, array($interface1))->willReturn('SplStack');
355
        $namer->name($class, array($interface2))->willReturn('SplStack');
356
        $class->getName()->willReturn('stdClass');
357
        $interface1->getName()->willReturn('ArrayAccess');
358
        $interface2->getName()->willReturn('Iterator');
359
360
        $alt1->apply($node1)->shouldBeCalled();
361
        $alt1->apply($node2)->shouldBeCalled();
362
        $alt2->apply($node2)->shouldNotBeCalled();
363
        $creator->create('SplStack', $node1)->shouldBeCalledTimes(1);
364
        $creator->create('SplStack', $node2)->shouldBeCalledTimes(1);
365
366
        $this->registerClassPatch($alt1);
367
        $this->double($class, array($interface1));
368
369
        $this->registerClassPatch($alt2);
370
        $this->double($class, array($interface2));
371
    }
372
373
    // T T F
374
    function it_creates_two_different_class_definitions_for_the_same_class_with_same_interfaces_and_different_patches(
375
        ClassMirror $mirror,
376
        ClassCreator $creator,
377
        NameGenerator $namer,
378
        ClassPatchInterface $alt1,
379
        ClassPatchInterface $alt2,
380
        \ReflectionClass $class,
381
        \ReflectionClass $interface1,
382
        \ReflectionClass $interface2,
383
        ClassNode $node1,
384
        ClassNode $node2
385
    ) {
386
        $mirror->reflect($class, array($interface1, $interface2))->willReturn($node1, $node2);
387
        $alt1->supports($node1)->willReturn(true);
388
        $alt1->supports($node2)->willReturn(true);
389
        $alt2->supports($node2)->willReturn(false);
390
        $alt1->getPriority()->willReturn(1);
391
        $alt2->getPriority()->willReturn(2);
392
        $namer->name($class, array($interface1, $interface2))->willReturn('SplStack');
393
        $class->getName()->willReturn('stdClass');
394
        $interface1->getName()->willReturn('ArrayAccess');
395
        $interface2->getName()->willReturn('Iterator');
396
397
        $alt1->apply($node1)->shouldBeCalled();
398
        $creator->create('SplStack', $node1)->shouldBeCalledTimes(1);
399
400
        $this->registerClassPatch($alt1);
401
        $this->double($class, array($interface1, $interface2));
402
403
        $alt1->apply($node2)->shouldBeCalled();
404
        $alt2->apply($node2)->shouldNotBeCalled();
405
        $creator->create('SplStack', $node2)->shouldBeCalledTimes(1);
406
407
        $this->registerClassPatch($alt2);
408
        $this->double($class, array($interface1, $interface2));
409
    }
410
}
411
412
class aClass
413
{
414
}