Issues (28)

Security Analysis    not enabled

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/Connection.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
 * @link http://www.yiiframework.com/
4
 * @copyright Copyright (c) 2008 Yii Software LLC
5
 * @license http://www.yiiframework.com/license/
6
 */
7
8
namespace edgardmessias\db\firebird;
9
10
/**
11
 *
12
 * @author Edgard Lorraine Messias <[email protected]>
13
 * @since 2.0
14
 */
15
class Connection extends \yii\db\Connection
16
{
17
    /**
18
     * Firebird server version
19
     */
20
    public $firebird_version = null;
21
    
22
    /**
23
     * @see https://www.firebirdsql.org/file/documentation/release_notes/html/en/3_0/rnfb30-ddl-enhance.html#rnfb30-ddl-identity
24
     * @var boolean|null
25
     */
26
    public $supportColumnIdentity = null;
27
    
28
    /**
29
     * @see https://firebirdsql.org/file/documentation/reference_manuals/fblangref25-en/html/fblangref25-dml-insert.html#fblangref25-dml-insert-select-unstable
30
     * @var boolean|null
31
     */
32
    public $supportStableCursor = null;
33
    
34
    /**
35
     * @see https://bugs.php.net/bug.php?id=72931
36
     * @var boolean|null
37
     */
38
    public $supportReturningInsert = null;
39
    
40
    /**
41
     * @see https://bugs.php.net/bug.php?id=61183
42
     * @var boolean|null
43
     */
44
    public $supportBlobDataType = null;
45
    
46
    /**
47 138
     * @inheritdoc
48
     */
49 138
    public $schemaMap = [
50
        'firebird' => 'edgardmessias\db\firebird\Schema', // Firebird
51
    ];
52
53
    /**
54
     * @inheritdoc
55
     */
56
    public $pdoClass = 'edgardmessias\db\firebird\PdoAdapter';
57
58 6
    /**
59
     * @inheritdoc
60 6
     */
61
    public $commandClass = 'edgardmessias\db\firebird\Command';
62 6
    /**
63 6
     * @var Transaction the currently active transaction
64
     */
65 6
    private $_transaction;
66
67 6
    /**
68
     * Returns the currently active transaction.
69
     * @return Transaction the currently active transaction. Null if no active transaction.
70 263
     */
71
    public function getTransaction()
72 263
    {
73 160
        return $this->_transaction && $this->_transaction->getIsActive() ? $this->_transaction : null;
74
    }
75 263
76 263
    /**
77
     * Starts a transaction.
78 160
     * @param string|null $isolationLevel The isolation level to use for this transaction.
79
     * See [[Transaction::begin()]] for details.
80 160
     * @return Transaction the transaction initiated
81
     */
82 160
    public function beginTransaction($isolationLevel = null)
83 148
    {
84
        $this->open();
85
86 160
        if (($transaction = $this->getTransaction()) === null) {
87
            $transaction = $this->_transaction = new Transaction(['db' => $this]);
88 160
        }
89 160
        $transaction->begin($isolationLevel);
90
91 160
        return $transaction;
92
    }
93
94
    public function close()
95
    {
96
        if ($this->pdo !== null) {
97
            $this->_transaction = null;
98
        }
99
        parent::close();
100
    }
101
102
    public function init()
103
    {
104
        parent::init();
105
        
106
        if ($this->firebird_version) {
107
            return;
108
        }
109
110
        try {
111
            $pdo = $this->createPdoInstance();
112
113
            $server_version = $pdo->getAttribute(\PDO::ATTR_SERVER_VERSION);
114
115
            if (preg_match('/\w{2}-[TV](\d+\.\d+\.\d+).*remote server/', $server_version, $matches)) {
116
                $this->firebird_version = $matches[1];
117
            }
118
        } catch (\Exception $ex) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
119
        }
120
        
121
        $supports = [
122
            'supportColumnIdentity' => version_compare($this->firebird_version, '3.0.0', '>='),
123
            'supportStableCursor' => version_compare($this->firebird_version, '3.0.0', '>='),
124
            'supportReturningInsert' => version_compare($this->firebird_version, '3.0.0', '<') || version_compare(phpversion('pdo_firebird'), '7.0.15', '>='),
125
            'supportBlobDataType' => version_compare(phpversion('pdo_firebird'), '7.0.13', '>'),
126
        ];
127
        
128
        foreach ($supports as $key => $value) {
129
            if ($this->{$key} === null) {
130
                $this->{$key} = $value;
131
            }
132
        }
133
    }
134
135
    /**
136
     * Reset the connection after cloning.
137
     */
138
    public function __clone()
139
    {
140
        parent::__clone();
141
142
        $this->_transaction = null;
143
    }
144
}
145