Issues (9)

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/Persistence/Pool.php (1 issue)

Labels
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
namespace FForattini\Btrieve\Persistence;
4
5
use Exception;
6
7
abstract class Pool implements DatasetInterface
8
{
9
    protected $dataset;
10
11
    /**
12
     * Contructor.
13
     */
14
    public function __construct()
15
    {
16
        $this->init();
17
    }
18
19
    /**
20
     * Initializes a pool of elements.
21
     *
22
     * @return Pool
23
     */
24
    public function init()
25
    {
26
        $this->dataset = [];
27
28
        return $this;
29
    }
30
31
    /**
32
     * Erase all information from dataset.
33
     *
34
     * @return Pool
35
     */
36
    public function reset()
37
    {
38
        foreach ($this->dataset as $index => $element) {
39
            unset($this->dataset[$index]);
40
        }
41
        unset($this->dataset);
42
        $this->initDataset();
0 ignored issues
show
The method initDataset() does not seem to exist on object<FForattini\Btrieve\Persistence\Pool>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
43
44
        return $this;
45
    }
46
47
    /**
48
     * Checks if this element exists in this dataset.
49
     *
50
     * @param int $index
51
     *
52
     * @return bool
53
     */
54
    public function has($index)
55
    {
56
        if (isset($this->dataset[$index])) {
57
            return true;
58
        }
59
60
        return false;
61
    }
62
63
    /**
64
     * @aliasof has
65
     *
66
     * @param int $index
67
     *
68
     * @return bool
69
     */
70
    public function exists($index)
71
    {
72
        return $this->has($index);
73
    }
74
75
    /**
76
     * Returns the element in this index from the dataset.
77
     *
78
     * @param int $index
79
     *
80
     * @return mixed
81
     */
82
    public function elem($index)
83
    {
84
        if ($this->has($index)) {
85
            return $this->dataset[$index];
86
        }
87
        throw new Exception('Element doesnt exist in this dataset.');
88
    }
89
90
    /**
91
     * Function will show how to deal with the element.
92
     *
93
     * @param array $element
94
     *
95
     * @return mixed
96
     */
97
    abstract public function cast($element);
98
99
    /**
100
     * Adds an element to the dataset.
101
     *
102
     * @param array $element
103
     */
104
    public function add($element)
105
    {
106
        $this->dataset[] = $this->cast($element);
107
    }
108
109
    /**
110
     * Return number of elements.
111
     *
112
     * @return int
113
     */
114
    public function count()
115
    {
116
        return count($this->dataset);
117
    }
118
}
119