Issues (1)

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/Oci8Connection.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 Jpina\Oci8;
4
5
/**
6
 * Class Connection
7
 * @package Jpina\Oci8
8
 * @see http://php.net/manual/en/book.oci8.php
9
 */
10
class Oci8Connection extends AbstractOci8Base implements Oci8ConnectionInterface
11
{
12
    /**
13
     * Connection constructor.
14
     * @param $username
15
     * @param $password
16
     * @param null $connectionString
17
     * @param null $characterSet
18
     * @param null $sessionMode
19
     * @throws \Jpina\Oci8\Oci8Exception
20
     */
21 8
    public function __construct(
22
        $username,
23
        $password,
24
        $connectionString = null,
25
        $characterSet = null,
26
        $sessionMode = null
27
    ) {
28 8
        $this->resource = $this->connect($username, $password, $connectionString, $characterSet, $sessionMode);
29 5
    }
30
31 3 View Code Duplication
    public function changePassword($username, $oldPassword, $newPassword)
32
    {
33 3
        set_error_handler(static::getErrorHandler());
34 3
        $isSuccess = oci_password_change($this->resource, $username, $oldPassword, $newPassword);
35 1
        restore_error_handler();
36 2
        return $isSuccess;
37
    }
38
39 2 View Code Duplication
    public function close()
40
    {
41 2
        $isSuccess = false;
42 2
        if ($this->resource) {
43 1
            set_error_handler(static::getErrorHandler());
44 1
            $isSuccess = oci_close($this->resource);
45 1
            restore_error_handler();
46 1
        }
47
48 2
        if ($isSuccess) {
49 1
            $this->resource = null;
50 1
        }
51
52 2
        return $isSuccess;
53
    }
54
55 2
    public function commit()
56
    {
57 2
        set_error_handler(static::getErrorHandler());
58 2
        $isSuccess = oci_commit($this->resource);
59 1
        restore_error_handler();
60 1
        return $isSuccess;
61
    }
62
63
    /**
64
     * Connect to the Oracle server using a unique connection
65
     *
66
     * @param string $username
67
     * @param string $password
68
     * @param string $connectionString
69
     * @param string $characterSet
70
     * @param int $sessionMode
71
     * @return resource
72
     * @throws \Jpina\Oci8\Oci8Exception
73
     * @see http://php.net/manual/en/function.oci-new-connect.php
74
     */
75 4
    protected function connect(
76
        $username,
77
        $password,
78
        $connectionString = null,
79
        $characterSet = null,
80
        $sessionMode = null
81
    ) {
82 4
        set_error_handler(static::getErrorHandler());
83 4
        $connection = oci_new_connect($username, $password, $connectionString, $characterSet, $sessionMode);
84 3
        restore_error_handler();
85 3
        return $connection;
86
    }
87
88 1
    public function copyLob($lobTo, $lobFrom, $length = 0)
89
    {
90 1
        set_error_handler(static::getErrorHandler());
91 1
        $isSuccess = oci_lob_copy($lobTo, $lobFrom, $length);
92 1
        restore_error_handler();
93 1
        return $isSuccess;
94
    }
95
96 2
    public function freeDescriptor($descriptor)
97
    {
98 2
        set_error_handler(static::getErrorHandler());
99 2
        $isSuccess = oci_free_descriptor($descriptor);
100 1
        restore_error_handler();
101 1
        return $isSuccess;
102
    }
103
104 1
    public function getClientMayorVersion()
105
    {
106 1
        $clientVersion = $this->getClientVersion();
107 1
        return (int) substr($clientVersion, 0, strpos($clientVersion, '.'));
108
    }
109
110 2
    public function getClientVersion()
111
    {
112 2
        return oci_client_version();
113
    }
114
115 2 View Code Duplication
    public function getNewCollection($tdo, $schema = null)
116
    {
117 2
        set_error_handler(static::getErrorHandler());
118 2
        $collection = oci_new_collection($this->resource, $tdo, $schema);
119 1
        restore_error_handler();
120 1
        return $collection;
121
    }
122
123 2
    public function getNewCursor()
124
    {
125 2
        set_error_handler(static::getErrorHandler());
126 2
        $cursor = oci_new_cursor($this->resource);
127 1
        restore_error_handler();
128 1
        return new Oci8Cursor($cursor);
129
    }
130
131 3
    public function getNewDescriptor($type = OCI_DTYPE_LOB)
132
    {
133 3
        set_error_handler(static::getErrorHandler());
134 3
        $descriptor = oci_new_descriptor($this->resource, $type);
0 ignored issues
show
Are you sure the assignment to $descriptor is correct as oci_new_descriptor($this->resource, $type) (which targets oci_new_descriptor()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
135 2
        restore_error_handler();
136 2
        return $descriptor;
137
    }
138
139 2
    public function getServerMayorVersion()
140
    {
141 2
        preg_match('/\\d+(:?\\.\\d+)+/', $this->getServerVersion(), $matches);
142 1
        return (int) substr($matches[0], 0, strpos($matches[0], '.'));
143
    }
144
145 4
    public function getServerVersion()
146
    {
147 4
        set_error_handler(static::getErrorHandler());
148 4
        $serverVersion = oci_server_version($this->resource);
149 2
        restore_error_handler();
150 2
        return $serverVersion;
151
    }
152
153 3
    public function isLobEqual($lob1, $lob2)
154
    {
155 3
        set_error_handler(static::getErrorHandler());
156 3
        $isEquals = oci_lob_is_equal($lob1, $lob2);
157 2
        restore_error_handler();
158 2
        return $isEquals;
159
    }
160
161 52
    public function parse($sqlText)
162
    {
163 52
        set_error_handler(static::getErrorHandler());
164 52
        $resource = oci_parse($this->resource, $sqlText);
165 51
        restore_error_handler();
166 51
        return new Oci8Statement($resource);
167
    }
168
169 2
    public function setAction($actionName)
170
    {
171 2
        set_error_handler(static::getErrorHandler());
172 2
        $isSuccess = oci_set_action($this->resource, $actionName);
173 1
        restore_error_handler();
174 1
        return $isSuccess;
175
    }
176
177 2
    public function setClientIdentifier($clientIdentifier)
178
    {
179 2
        set_error_handler(static::getErrorHandler());
180 2
        $isSuccess = oci_set_client_identifier($this->resource, $clientIdentifier);
181 1
        restore_error_handler();
182 1
        return $isSuccess;
183
    }
184
185 2
    public function setClientInfo($clientInfo)
186
    {
187 2
        set_error_handler(static::getErrorHandler());
188 2
        $isSuccess = oci_set_client_info($this->resource, $clientInfo);
189 1
        restore_error_handler();
190 1
        return $isSuccess;
191
    }
192
193 2
    public static function setEdition($edition)
194
    {
195 2
        set_error_handler(static::getErrorHandler());
196 2
        $isSuccess = oci_set_edition($edition);
197 2
        restore_error_handler();
198 2
        return $isSuccess;
199
    }
200
201 1
    public function setInternalDebug($onOff)
202
    {
203 1
        oci_internal_debug($onOff);
204 1
    }
205
206 2
    public function setModuleName($moduleName)
207
    {
208 2
        set_error_handler(static::getErrorHandler());
209 2
        $isSuccess = oci_set_module_name($this->resource, $moduleName);
210 1
        restore_error_handler();
211 1
        return $isSuccess;
212
    }
213
214 2
    public function rollback()
215
    {
216 2
        set_error_handler(static::getErrorHandler());
217 2
        $isSuccess = oci_rollback($this->resource);
218 1
        restore_error_handler();
219 1
        return $isSuccess;
220
    }
221
}
222