Issues (6)

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/Console.php (6 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
 * Jaeger
4
 *
5
 * @author		Eric Lamb <[email protected]>
6
 * @copyright	Copyright (c) 2015-2016, mithra62, Eric Lamb
7
 * @link		http://jaeger-app.com
8
 * @version		1.0
9
 * @filesource 	./Console.php
10
 */
11
 
12
namespace JaegerApp;
13
14
/**
15
 * Jaeger - Console Output Object
16
 *
17
 * Handles outputting/writing data to the console 
18
 *
19
 * @package Platforms\Console
20
 * @author Eric Lamb <[email protected]>
21
 */
22
class Console
23
{
24
    /**
25
     * The arguments object
26
     * 
27
     * @var \cli\Arguments
28
     */
29
    protected $args = null;
30
31
    /**
32
     * The mithra62 Language object
33
     * 
34
     * @param
35
     *            Language
36
     */
37
    protected $lang = null;
38
39
    /**
40
     * The cli input string
41
     * 
42
     * @param string $tokens            
0 ignored issues
show
There is no parameter named $tokens. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
43
     */
44
    public function __construct()
45
    {}
46
47
    /**
48
     * Outputs an error to the console
49
     * 
50
     * @param string $error
51
     *            The language key for the message to display
52
     */
53
    public function outputError($error)
54
    {
55
        \cli\err($this->getLang()->__($error));
56
    }
57
58
    /**
59
     * Outputs a new line
60
     * 
61
     * @param string $string The output we want to display to the console out
62
     * @param bool $translate Whether the string should be sent through the mithra62\Language object
63
     * @return void
64
     */
65
    public function outputLine($string = '', $translate = true)
66
    {
67
        if ($translate) {
68
            \cli\line($this->getLang()->__($string));
69
        } else {
70
            \cli\line($string);
71
        }
72
    }
73
74
    /**
75
     * Adds a new line with page break
76
     */
77
    public function outputPageBreak()
78
    {
79
        \cli\line('');
80
        \cli\line('========================================================');
81
    }
82
83
    /**
84
     * An instance of the language object
85
     * 
86
     * @return \JaegerApp\Language
87
     */
88
    public function getLang()
89
    {
90
        return $this->lang;
91
    }
92
93
    /**
94
     * Sets the language object
95
     * 
96
     * @param Language $lang            
97
     * @return \JaegerApp\Console
98
     */
99
    public function setLang(Language $lang)
100
    {
101
        $this->lang = $lang;
102
        return $this;
103
    }
104
105
    /**
106
     * Returns the available commands the Console provides
107
     * @see \cli\Arguments
108
     * @param string $strict
109
     * @param string $force
110
     * @return \cli\Arguments
111
     */
112
    public function getArgs($strict = false, $force = false)
113
    {
114
        if (is_null($this->args) || $force) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $force of type false|string is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== false instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
115
            $this->args = new \cli\Arguments($strict);
0 ignored issues
show
$strict is of type false|string, but the function expects a array.

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...
116
            $this->args->addFlag(array(
117
                'verbose',
118
                'v'
119
            ), 'Turn on verbose output');
0 ignored issues
show
'Turn on verbose output' is of type string, but the function expects a array.

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...
120
            $this->args->addFlag('version', 'Display the version');
0 ignored issues
show
'Display the version' is of type string, but the function expects a array.

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...
121
            $this->args->addFlag(array(
122
                'help',
123
                'h'
124
            ), 'Show this help screen');
0 ignored issues
show
'Show this help screen' is of type string, but the function expects a array.

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...
125
        }
126
        
127
        return $this->args;
128
    }
129
}