GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (2170)

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.

application/components/ExtensionModule.php (7 issues)

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 app\components;
4
5
use app;
6
use app\modules\config\models\Configurable;
7
use app\modules\config\helpers\ConfigurationUpdater;
8
use devgroup\TagDependencyHelper\ActiveRecordHelper;
9
use Symfony\Component\Process\Process;
10
use Yii;
11
12
/**
13
 * Class ExtensionModule is the base module that must use all DotPlant2 extensions
14
 *
15
 * @package app\components
16
 */
17
abstract class ExtensionModule extends \yii\base\Module
18
{
19
    /**
20
     * @var string Path to migrations folder inside extension root source directory
21
     */
22
    public $migrationsFolder = 'migrations';
23
24
    /**
25
     * ID of module for application config.
26
     * You must override it in your extension.
27
     */
28
    public static $moduleId = 'temporary-module';
29
30
    /**
31
     * Installs module
32
     * @param bool $applyAppMigrations
33
     * @param bool $updateComposer
34
     * @return mixed
0 ignored issues
show
Consider making the return type a bit more specific; maybe use boolean.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
35
     */
36
    public static function installModule($applyAppMigrations = true, $updateComposer = true)
37
    {
38
        Yii::$app->setModule(
39
            static::$moduleId,
40
            static::className()
0 ignored issues
show
static::className() is of type string, but the function expects a object<yii\base\Module>|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Deprecated Code introduced by
The method yii\base\BaseObject::className() has been deprecated with message: since 2.0.14. On PHP >=5.5, use `::class` instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
41
        );
42
        /** @var ExtensionModule $module */
43
        $module = Yii::$app->getModule(static::$moduleId);
44
        return $module->updateModule($applyAppMigrations, $updateComposer, true);
45
    }
46
47
    /**
48
     * Updates/installs module
49
     *
50
     * @param bool $applyAppMigrations True if we need to apply app migrations
51
     * @param bool $updateComposer True if we need to update composer
52
     */
53
    public function updateModule($applyAppMigrations = true, $updateComposer = true, $updateConfig = true)
54
    {
55
        // apply migrations
56
        $migrationPath = $this->getMigrationsPath();
57
58
        /** @var Process $process */
59
        $process = Yii::$app->updateHelper
60
            ->applyMigrations(
61
                $migrationPath,
62
                $this->getMigrationTable(),
63
                $applyAppMigrations,
64
                $updateComposer
65
            );
66
        $process->mustRun();
67
68
69
        if ($updateConfig === true) {
70
            $this->updateConfig();
71
        }
72
73
        return $process->getExitCode() === 0;
74
    }
75
76
    /**
77
     * Uninstalls module
78
     * @return bool True if ok
79
     */
80
    public function uninstallModule()
81
    {
82
83
        $this->removeConfig();
84
85
        // apply migrations
86
        $migrationPath = $this->getMigrationsPath();
87
88
        /** @var Process $process */
89
        $process = Yii::$app->updateHelper
90
            ->applyMigrations(
91
                $migrationPath,
92
                $this->getMigrationTable(),
93
                false,
94
                false,
95
                true
96
            );
97
        $process->mustRun();
98
99
        return $process->getExitCode() === 0;
100
    }
101
102
    /**
103
     * @return string Full real path to module migrations
104
     */
105
    public function getMigrationsPath()
106
    {
107
        $reflectionClass = new \ReflectionClass($this);
108
        $directory = dirname($reflectionClass->getFileName());
109
110
        return realpath(
111
            "$directory/{$this->migrationsFolder}/"
112
        );
113
    }
114
115
    /**
116
     * @return string Returns name of migration table
117
     */
118
    public function getMigrationTable()
119
    {
120
        return 'migrations_' . md5($this->className());
0 ignored issues
show
Deprecated Code introduced by
The method yii\base\BaseObject::className() has been deprecated with message: since 2.0.14. On PHP >=5.5, use `::class` instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
121
    }
122
123
    /**
124
     * Update configurable config if it exists.
125
     * Unexistent values will be filled with default values.
126
     */
127
    public function updateConfig()
128
    {
129
        if ($this->getBehavior('configurableModule') !== null) {
130
            // This extension has config behavior
131
132
            // Find corresponding configurable
133
            $configurable = Configurable::find()
134
                ->where(['module' => $this->id])
135
                ->one();
136
137
            if ($configurable !== null) {
138
                // We should save default values of it
139
                $array = [$configurable];
140
                ConfigurationUpdater::updateConfiguration(
141
                    $array,
0 ignored issues
show
$array is of type array<integer,object<yii...\ActiveRecord>|array"}>, but the function expects a array<integer,object<app...g\models\Configurable>>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
142
                    false
143
                );
144
145
            }
146
147
148
        }
149
        \yii\caching\TagDependency::invalidate(
150
            Yii::$app->cache,
151
            [
152
                ActiveRecordHelper::getCommonTag(Configurable::className()),
0 ignored issues
show
Deprecated Code introduced by
The method yii\base\BaseObject::className() has been deprecated with message: since 2.0.14. On PHP >=5.5, use `::class` instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
153
154
            ]
155
        );
156
    }
157
158
    /**
159
     * Remove module configuration from config files.
160
     */
161
    public function removeConfig()
162
    {
163
        if ($this->getBehavior('configurableModule') !== null) {
164
            // This extension has config behavior
165
166
            // Find corresponding configurable
167
            $configurables = Configurable::find()
168
                ->where('module!=:module', [':module' => $this->id])
169
                ->all();
170
171
            if ($configurables !== null) {
172
                // The trick is to use previous saved values from other configurables
173
                // and exclude current module from configuration
174
                // that is done by setting not to load existing configuration
175
176
                ConfigurationUpdater::updateConfiguration(
177
                    $configurables,
178
                    false,
179
                    false
180
                );
181
182
            }
183
184
185
        }
186
        \yii\caching\TagDependency::invalidate(
187
            Yii::$app->cache,
188
            [
189
                ActiveRecordHelper::getCommonTag(Configurable::className()),
0 ignored issues
show
Deprecated Code introduced by
The method yii\base\BaseObject::className() has been deprecated with message: since 2.0.14. On PHP >=5.5, use `::class` instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
190
191
            ]
192
        );
193
    }
194
195
196
}