Showing 2,235 of 2,235 total issues
loadEnvironmentVariablesContainingLogic accesses the super-global variable $_ENV. Open
private function loadEnvironmentVariablesContainingLogic()
{
$_ENV['TRIM_OS'] = strtoupper(substr(PHP_OS, 0, 3));
if ($_ENV['TRIM_OS'] === 'WIN') {
- Read upRead up
- Exclude checks
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
getEnvironmentVariables accesses the super-global variable $_SERVER. Open
protected function getEnvironmentVariables()
{
return array_merge($_ENV, $_SERVER);
}
- Read upRead up
- Exclude checks
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($new)) {
$io->writeln("New files found on remote host:");
foreach ($newFlat as $key => $file) {
$io->writeln("\t[$key] $file");
}
- Read upRead up
- Exclude checks
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
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']);
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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(?array $directives = null)
{
if ($directives !== null) {
$this->dangerousDirectives = $directives;
} elseif (! empty($_ENV[self::ENV_KEY])) {
- Read upRead up
- Exclude checks
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($del)) {
$io->writeln("<comment>Deleted files were found on remote host:</comment>");
foreach ($delFlat as $key => $file) {
$io->writeln("\t[$key] $file");
}
- Read upRead up
- Exclude checks
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()
{
$logMaxFiles = $_ENV['LOG_MAX_FILES'] ?? 30;
$formatter = new LineFormatter(null, null, true, true);
$handler = new RotatingFileHandler($_ENV['TRIM_OUTPUT'], $logMaxFiles, Logger::INFO);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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
trim_debug accesses the super-global variable $_ENV. Open
function trim_debug($output)
{
if ($_ENV['TRIM_DEBUG']) {
trim_output($output);
}
- Read upRead up
- Exclude checks
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
formatBranch accesses the super-global variable $_ENV. Open
public static function formatBranch($branch, $vcs = null)
{
$vcs = strtolower($vcs ?? $_ENV['DEFAULT_VCS']);
if ($vcs == 'svn') {
- Read upRead up
- Exclude checks
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 debug() calls the typical debug function debug_print_backtrace() which is mostly only used during development. Open
debug_print_backtrace();
- Read upRead up
- Exclude checks
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
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']);
- Read upRead up
- Exclude checks
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";
- Read upRead up
- Exclude checks
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
}
- Read upRead up
- Exclude checks
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
}
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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
promptUser accesses the super-global variable $_ENV. Open
function promptUser($prompt, $default = false, $values = [])
{
if (!$_ENV['INTERACTIVE']) {
return $default;
}
- Read upRead up
- Exclude checks
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
cache_folder accesses the super-global variable $_ENV. Open
function cache_folder($app, $version)
{
$key = sprintf('%s-%s-%s', $app->getName(), $version->type, $version->branch);
$key = str_replace('/', '_', $key);
$folder = $_ENV['CACHE_FOLDER'] . "/$key";
- Read upRead up
- Exclude checks
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'];
}
}