Issues (44)

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/QueryNode.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
namespace Graze\DataDb;
4
5
use Graze\DataDb\Adapter\AdapterInterface;
6
use Traversable;
7
8
class QueryNode implements QueryNodeInterface
9
{
10
    /** @var AdapterInterface */
11
    private $adapter;
12
    /** @var string */
13
    private $sql;
14
    /** @var array */
15
    private $bind = [];
16
    /** @var string[] */
17
    private $columns = [];
18
19
    /**
20
     * QueryNode constructor.
21
     *
22
     * @param AdapterInterface $adapter
23
     * @param string           $sql
24
     * @param array            $bind
25
     */
26
    public function __construct(AdapterInterface $adapter, $sql, array $bind = [])
27
    {
28
        $this->adapter = $adapter;
29
        $this->sql = $sql;
30
        $this->bind = $bind;
31
    }
32
33
    #region Properties
34
35
    /**
36
     * @return AdapterInterface
37
     */
38
    public function getAdapter()
39
    {
40
        return $this->adapter;
41
    }
42
43
    /**
44
     * @param AdapterInterface $adapter
45
     *
46
     * @return static
47
     */
48
    public function setAdapter(AdapterInterface $adapter)
49
    {
50
        $this->adapter = $adapter;
51
        return $this;
52
    }
53
54
    /**
55
     * @return mixed
56
     */
57
    public function getSql()
58
    {
59
        return $this->sql;
60
    }
61
62
    /**
63
     * @param mixed $sql
64
     *
65
     * @return static
66
     */
67
    public function setSql($sql)
68
    {
69
        $this->sql = $sql;
70
        return $this;
71
    }
72
73
    /**
74
     * @return array
75
     */
76
    public function getBind()
77
    {
78
        return $this->bind;
79
    }
80
81
    /**
82
     * @param array $bind
83
     *
84
     * @return static
85
     */
86
    public function setBind(array $bind)
87
    {
88
        $this->bind = $bind;
89
        return $this;
90
    }
91
92
    /**
93
     * @return string[]
94
     */
95
    public function getColumns()
96
    {
97
        return $this->columns;
98
    }
99
100
    /**
101
     * @param string[] $columns
102
     *
103
     * @return static
104
     */
105
    public function setColumns(array $columns)
106
    {
107
        $this->columns = $columns;
108
        return $this;
109
    }
110
111
    #endregion
112
113
    #region Query
114
115
    /**
116
     * @return mixed
117
     */
118
    public function query()
119
    {
120
        return $this->adapter->query($this->sql, $this->bind);
121
    }
122
123
    /**
124
     * @return Traversable
125
     */
126
    public function fetch()
127
    {
128
        return $this->adapter->fetch($this->sql, $this->bind);
129
    }
130
131
    /**
132
     * @return array
133
     */
134
    public function fetchAll()
135
    {
136
        return $this->adapter->fetchAll($this->sql, $this->bind);
137
    }
138
139
    /**
140
     * @return array
141
     */
142
    public function fetchRow()
143
    {
144
        return $this->adapter->fetchRow($this->sql, $this->bind);
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->adapter->fetchRow...his->sql, $this->bind); of type array|boolean adds the type boolean to the return on line 144 which is incompatible with the return type declared by the interface Graze\DataDb\QueryNodeInterface::fetchRow of type array.
Loading history...
145
    }
146
147
    /**
148
     * @return mixed
149
     */
150
    public function fetchOne()
151
    {
152
        return $this->adapter->fetchOne($this->sql, $this->bind);
153
    }
154
155
    #endregion
156
157
    /**
158
     * @return string
159
     */
160
    public function __toString()
161
    {
162
        return 'Query: ' . substr($this->sql, 0, 18) . '...';
163
    }
164
165
    /**
166
     * Return a clone of this object
167
     *
168
     * @return static
169
     */
170
    public function getClone()
171
    {
172
        return clone $this;
173
    }
174
}
175