TikiWiki/tiki-manager

View on GitHub

Showing 2,235 of 2,235 total issues

handleCheckResult accesses the super-global variable $_ENV.
Open

    public static function handleCheckResult(Instance $instance, Version $version, $array)
    {
        if (! $_ENV['INTERACTIVE']) {
            return; // skip
        }
Severity: Minor
Found in src/Libs/Helpers/Checksum.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

The function query() calls the typical debug function debug_print_backtrace() which is mostly only used during development.
Open

            debug_print_backtrace();
Severity: Minor
Found in src/Libs/Helpers/functions.php by phpmd

DevelopmentCodeFragment

Since: 2.3.0

Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.

Example

class SuspectCode {

    public function doSomething(array $items)
    {
        foreach ($items as $i => $item) {
            // …

            if ('qafoo' == $item) var_dump($i);

            // …
        }
    }
}

Source https://phpmd.org/rules/design.html#developmentcodefragment

The method readManifest() has a Cyclomatic Complexity of 22. The configured cyclomatic complexity threshold is 10.
Open

    public function readManifest($manifestPath)
    {
        $differentInstance = $this->instance->getId() != $this->getSourceInstance()->getId();

        $skipPathCheck = ($this->allowCommonParents < 0) || (count(explode('/', $this->instance->webroot)) < $this->allowCommonParents);
Severity: Minor
Found in src/Application/Restore.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

The method restoreFolder() has a Cyclomatic Complexity of 25. The configured cyclomatic complexity threshold is 10.
Open

    public function restoreFolder($src, $target, $isFull = false)
    {
        $access = $this->getAccess();
        $instance = $this->instance;
        $src = rtrim($src, '/\\');
Severity: Minor
Found in src/Application/Restore.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

handleCheckResult accesses the super-global variable $_ENV.
Open

    public static function handleCheckResult(Instance $instance, Version $version, $array)
    {
        if (! $_ENV['INTERACTIVE']) {
            return; // skip
        }
Severity: Minor
Found in src/Libs/Helpers/Checksum.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

handleCheckResult accesses the super-global variable $_ENV.
Open

    public static function handleCheckResult(Instance $instance, Version $version, $array)
    {
        if (! $_ENV['INTERACTIVE']) {
            return; // skip
        }
Severity: Minor
Found in src/Libs/Helpers/Checksum.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

The function promptUser() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
Open

function promptUser($prompt, $default = false, $values = [])
{
    if (!$_ENV['INTERACTIVE']) {
        return $default;
    }
Severity: Minor
Found in src/Libs/Helpers/functions.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

setupPhar accesses the super-global variable $_ENV.
Open

function setupPhar()
{
    $pharPath = Phar::running(false);

    $phar = new Phar($pharPath);
Severity: Minor
Found in src/Libs/Helpers/functions.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

The method restoreFilesFromFolder() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
Open

    protected function restoreFilesFromFolder(string $srcFolder)
    {
        $manifest = "{$srcFolder}/manifest.txt";
        $folders = $this->readManifest($manifest);

Severity: Minor
Found in src/Application/Restore.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

__construct accesses the super-global variable $_ENV.
Open

    public function __construct()
    {
        $logMaxFiles = $_ENV['LOG_MAX_FILES'] ?? 30;
        $formatter = new LineFormatter(null, null, true, true);
        $handler = new RotatingFileHandler($_ENV['TRIM_OUTPUT'], $logMaxFiles, Logger::INFO);
Severity: Minor
Found in src/Libs/Helpers/LoggerManager.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

__construct accesses the super-global variable $_ENV.
Open

    public function __construct($dsn, $user = '', $password = '', $options = [])
    {
        $this->dieOnException = $_ENV['PDO_DIE_ON_EXCEPTION_THROWN'];
        $this->hasExtendedDebug = $_ENV['PDO_EXTENDED_DEBUG'];

Severity: Minor
Found in src/Libs/Helpers/PDOWrapper.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

The function query() calls the typical debug function var_dump() which is mostly only used during development.
Open

            var_dump($params);
Severity: Minor
Found in src/Libs/Helpers/functions.php by phpmd

DevelopmentCodeFragment

Since: 2.3.0

Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.

Example

class SuspectCode {

    public function doSomething(array $items)
    {
        foreach ($items as $i => $item) {
            // …

            if ('qafoo' == $item) var_dump($i);

            // …
        }
    }
}

Source https://phpmd.org/rules/design.html#developmentcodefragment

__construct accesses the super-global variable $_ENV.
Open

    public function __construct(?array $directives = null)
    {
        if ($directives !== null) {
            $this->dangerousDirectives = $directives;
        } elseif (! empty($_ENV[self::ENV_KEY])) {

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Avoid using TikiManager\Libs\Helpers\count() function in while loops.
Open

        while ($input != 's' && count($mod)) {
            $io->writeln("Modified files were found on remote host:");

            foreach ($modFlat as $key => $file) {
                $io->writeln("\t[$key] $file");
Severity: Minor
Found in src/Libs/Helpers/Checksum.php by phpmd

CountInLoopExpression

Since: 2.7.0

Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.

Example

class Foo {

  public function bar()
  {
    $array = array();

    for ($i = 0; count($array); $i++) {
      // ...
    }
  }
}

Source https://phpmd.org/rules/design.html#countinloopexpression

__construct accesses the super-global variable $_ENV.
Open

    public function __construct($dsn, $user = '', $password = '', $options = [])
    {
        $this->dieOnException = $_ENV['PDO_DIE_ON_EXCEPTION_THROWN'];
        $this->hasExtendedDebug = $_ENV['PDO_EXTENDED_DEBUG'];

Severity: Minor
Found in src/Libs/Helpers/PDOWrapper.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

__construct accesses the super-global variable $_ENV.
Open

    public function __construct()
    {
        $logMaxFiles = $_ENV['LOG_MAX_FILES'] ?? 30;
        $formatter = new LineFormatter(null, null, true, true);
        $handler = new RotatingFileHandler($_ENV['TRIM_OUTPUT'], $logMaxFiles, Logger::INFO);
Severity: Minor
Found in src/Libs/Helpers/LoggerManager.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

__construct accesses the super-global variable $_ENV.
Open

    public function __construct($dsn, $user = '', $password = '', $options = [])
    {
        $this->dieOnException = $_ENV['PDO_DIE_ON_EXCEPTION_THROWN'];
        $this->hasExtendedDebug = $_ENV['PDO_EXTENDED_DEBUG'];

Severity: Minor
Found in src/Libs/Helpers/PDOWrapper.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

secure_trim_data accesses the super-global variable $_ENV.
Open

function secure_trim_data($should_set = false)
{
    $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
    $stat = stat($_ENV['TRIM_DATA']);

Severity: Minor
Found in src/Libs/Helpers/functions.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

setupPhar accesses the super-global variable $_ENV.
Open

function setupPhar()
{
    $pharPath = Phar::running(false);

    $phar = new Phar($pharPath);
Severity: Minor
Found in src/Libs/Helpers/functions.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

debug accesses the super-global variable $_ENV.
Open

function debug($text, $prefix = null, $hr = '')
{
    if (isset($_ENV['TRIM_DEBUG']) && $_ENV['TRIM_DEBUG'] === true) {
        $prefix = '[' . date('Y-m-d H:i:s') . '][debug]:' . ($prefix ? " {$prefix}" : '');
        $output = "\n";
Severity: Minor
Found in src/Libs/Helpers/functions.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Severity
Category
Status
Source
Language