Issues (7)

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.

src/Merger.php (1 issue)

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
declare(strict_types = 1);
4
5
namespace iio\libmergepdf;
6
7
use iio\libmergepdf\Driver\DriverInterface;
8
use iio\libmergepdf\Driver\DefaultDriver;
9
use iio\libmergepdf\Source\SourceInterface;
10
use iio\libmergepdf\Source\FileSource;
11
use iio\libmergepdf\Source\RawSource;
12
13
/**
14
 * Merge existing pdfs into one
15
 *
16
 * Note that your PDFs are merged in the order that you add them
17
 */
18
final class Merger
19
{
20
    /**
21
     * @var SourceInterface[] List of pdf sources to merge
22
     */
23
    private $sources = [];
24
25
    /**
26
     * @var DriverInterface
27
     */
28
    private $driver;
29
30
    public function __construct(DriverInterface $driver = null)
31
    {
32
        $this->driver = $driver ?: new DefaultDriver;
33
    }
34
35
    /**
36
     * Add raw PDF from string
37
     */
38
    public function addRaw(string $content, PagesInterface $pages = null): void
39
    {
40
        $this->sources[] = new RawSource($content, $pages);
41
    }
42
43
    /**
44
     * Add PDF from file
45
     */
46
    public function addFile(string $filename, PagesInterface $pages = null): void
47
    {
48
        $this->sources[] = new FileSource($filename, $pages);
49
    }
50
51
    /**
52
     * Add files using iterator
53
     *
54
     * @param iterable<string> $iterator Set of filenames to add
0 ignored issues
show
The doc-type iterable<string> could not be parsed: Expected "|" or "end of type", but got "<" at position 8. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
55
     * @param PagesInterface $pages Optional pages constraint used for every added pdf
56
     */
57
    public function addIterator(iterable $iterator, PagesInterface $pages = null): void
58
    {
59
        foreach ($iterator as $filename) {
60
            $this->addFile($filename, $pages);
61
        }
62
    }
63
64
    /**
65
     * Merges loaded PDFs
66
     */
67
    public function merge(): string
68
    {
69
        return $this->driver->merge(...$this->sources);
70
    }
71
72
    /**
73
     * Reset internal state
74
     */
75
    public function reset(): void
76
    {
77
        $this->sources = [];
78
    }
79
}
80