Issues (15)

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/Snappy/Generator/LoggableGeneratorTest.php (10 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 Knp\Bundle\SnappyBundle\Tests\Snappy\Generator;
4
5
use Knp\Bundle\SnappyBundle\Snappy\Generator\LoggableGenerator;
6
use PHPUnit\Framework\TestCase;
7
8
/**
9
 * @group legacy
10
 */
11
class LoggableGeneratorTest extends TestCase
12
{
13
    public function testGenerate()
14
    {
15
        $internal = $this->createMock('Knp\Snappy\GeneratorInterface');
16
        $internal
17
            ->expects($this->once())
18
            ->method('generate')
19
            ->with(
20
                $this->equalTo('the_input_file'),
21
                $this->equalTo('the_output_file'),
22
                $this->equalTo(['foo' => 'bar']),
23
                $this->equalTo(true)
24
            );
25
26
        $logger = $this->createMock('Psr\Log\LoggerInterface');
27
        $logger
28
            ->expects($this->once())
29
            ->method('debug')
30
            ->with($this->equalTo('Generate from file (the_input_file) to file (the_output_file).'));
31
32
        $generator = new LoggableGenerator($internal, $logger);
0 ignored issues
show
Deprecated Code introduced by
The class Knp\Bundle\SnappyBundle\...rator\LoggableGenerator has been deprecated with message: Logging capability is now directly integrated in Snappy. You should use it rather than this Decorator.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
33
        $generator->generate('the_input_file', 'the_output_file', ['foo' => 'bar'], true);
34
    }
35
36
    public function testGenerateFromHtml()
37
    {
38
        $internal = $this->createMock('Knp\Snappy\GeneratorInterface');
39
        $internal
40
            ->expects($this->once())
41
            ->method('generateFromHtml')
42
            ->with(
43
                $this->equalTo('<html>foo</html>'),
44
                $this->equalTo('the_output_file'),
45
                $this->equalTo(['foo' => 'bar']),
46
                $this->equalTo(true)
47
            );
48
49
        $logger = $this->createMock('Psr\Log\LoggerInterface');
50
        $logger
51
            ->expects($this->once())
52
            ->method('debug')
53
            ->with($this->equalTo('Generate from HTML (<html>foo</html>) to file (the_output_file).'));
54
55
        $generator = new LoggableGenerator($internal, $logger);
0 ignored issues
show
Deprecated Code introduced by
The class Knp\Bundle\SnappyBundle\...rator\LoggableGenerator has been deprecated with message: Logging capability is now directly integrated in Snappy. You should use it rather than this Decorator.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
56
        $generator->generateFromHtml('<html>foo</html>', 'the_output_file', ['foo' => 'bar'], true);
57
    }
58
59
    public function testGenerateFromHtmlWithHtmlArray()
60
    {
61
        $internal = $this->createMock('Knp\Snappy\GeneratorInterface');
62
        $internal
63
            ->expects($this->once())
64
            ->method('generateFromHtml')
65
            ->with(
66
                $this->equalTo(['<html>foo</html>', '<html>bar</html>']),
67
                $this->equalTo('the_output_file'),
68
                $this->equalTo(['foo' => 'bar']),
69
                $this->equalTo(true)
70
            );
71
72
        $logger = $this->createMock('Psr\Log\LoggerInterface');
73
        $logger
74
            ->expects($this->once())
75
            ->method('debug')
76
            ->with($this->equalTo('Generate from HTML (<html>foo</html>, <html>bar</html>) to file (the_output_file).'));
77
78
        $generator = new LoggableGenerator($internal, $logger);
0 ignored issues
show
Deprecated Code introduced by
The class Knp\Bundle\SnappyBundle\...rator\LoggableGenerator has been deprecated with message: Logging capability is now directly integrated in Snappy. You should use it rather than this Decorator.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
79
        $generator->generateFromHtml(['<html>foo</html>', '<html>bar</html>'], 'the_output_file', ['foo' => 'bar'], true);
80
    }
81
82
    public function testOutput()
83
    {
84
        $internal = $this->createMock('Knp\Snappy\GeneratorInterface');
85
        $internal
86
            ->expects($this->once())
87
            ->method('getOutput')
88
            ->with(
89
                $this->equalTo('the_input_file'),
90
                $this->equalTo(['foo' => 'bar'])
91
            );
92
93
        $logger = $this->createMock('Psr\Log\LoggerInterface');
94
        $logger
95
            ->expects($this->once())
96
            ->method('debug')
97
            ->with($this->equalTo('Output from file (the_input_file).'));
98
99
        $generator = new LoggableGenerator($internal, $logger);
0 ignored issues
show
Deprecated Code introduced by
The class Knp\Bundle\SnappyBundle\...rator\LoggableGenerator has been deprecated with message: Logging capability is now directly integrated in Snappy. You should use it rather than this Decorator.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
100
        $generator->getOutput('the_input_file', ['foo' => 'bar'], true);
0 ignored issues
show
The call to LoggableGenerator::getOutput() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
101
    }
102
103
    public function testOutputFromHtml()
104
    {
105
        $internal = $this->createMock('Knp\Snappy\GeneratorInterface');
106
        $internal
107
            ->expects($this->once())
108
            ->method('getOutputFromHtml')
109
            ->with(
110
                $this->equalTo('<html>foo</html>'),
111
                $this->equalTo(['foo' => 'bar'])
112
            );
113
114
        $logger = $this->createMock('Psr\Log\LoggerInterface');
115
        $logger
116
            ->expects($this->once())
117
            ->method('debug')
118
            ->with($this->equalTo('Output from HTML (<html>foo</html>).'));
119
120
        $generator = new LoggableGenerator($internal, $logger);
0 ignored issues
show
Deprecated Code introduced by
The class Knp\Bundle\SnappyBundle\...rator\LoggableGenerator has been deprecated with message: Logging capability is now directly integrated in Snappy. You should use it rather than this Decorator.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
121
        $generator->getOutputFromHtml('<html>foo</html>', ['foo' => 'bar'], true);
0 ignored issues
show
The call to LoggableGenerator::getOutputFromHtml() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
122
    }
123
124
    public function testOutputFromHtmlWithHtmlArray()
125
    {
126
        $internal = $this->createMock('Knp\Snappy\GeneratorInterface');
127
        $internal
128
            ->expects($this->once())
129
            ->method('getOutputFromHtml')
130
            ->with(
131
                $this->equalTo(['<html>foo</html>']),
132
                $this->equalTo(['foo' => 'bar'])
133
            );
134
135
        $logger = $this->createMock('Psr\Log\LoggerInterface');
136
        $logger
137
            ->expects($this->once())
138
            ->method('debug')
139
            ->with($this->equalTo('Output from HTML (<html>foo</html>).'));
140
141
        $generator = new LoggableGenerator($internal, $logger);
0 ignored issues
show
Deprecated Code introduced by
The class Knp\Bundle\SnappyBundle\...rator\LoggableGenerator has been deprecated with message: Logging capability is now directly integrated in Snappy. You should use it rather than this Decorator.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
142
        $generator->getOutputFromHtml(['<html>foo</html>'], ['foo' => 'bar'], true);
0 ignored issues
show
The call to LoggableGenerator::getOutputFromHtml() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
143
    }
144
145
    public function testSetOption()
146
    {
147
        $internal = $this->createMock('Knp\Snappy\Image');
148
        $internal
149
            ->expects($this->at(0))
150
            ->method('setOption')
151
            ->with(
152
                $this->equalTo('foo'),
153
                $this->equalTo('bar')
154
            );
155
        $internal
156
            ->expects($this->at(1))
157
            ->method('setOption')
158
            ->with(
159
                $this->equalTo('foo'),
160
                $this->equalTo(['bar'=>'baz'])
161
            );
162
163
        $logger = $this->createMock('Psr\Log\LoggerInterface');
164
        $logger
165
            ->expects($this->at(0))
166
            ->method('debug')
167
            ->with($this->equalTo('Set option foo = \'bar\'.'));
168
        $logger
169
            ->expects($this->at(1))
170
            ->method('debug')
171
            ->with($this->equalTo(
172
                'Set option foo = array (
173
  \'bar\' => \'baz\',
174
).'
175
            ));
176
177
        $generator = new LoggableGenerator($internal, $logger);
0 ignored issues
show
Deprecated Code introduced by
The class Knp\Bundle\SnappyBundle\...rator\LoggableGenerator has been deprecated with message: Logging capability is now directly integrated in Snappy. You should use it rather than this Decorator.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
178
        $generator->setOption('foo', 'bar');
179
        $generator->setOption('foo', ['bar'=>'baz']);
180
    }
181
}
182