Issues (1165)

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/Object/Blob.php (20 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
class Kint_Object_Blob extends Kint_Object
0 ignored issues
show
Kint_Object_Blob does not seem to conform to the naming convention (^[A-Z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
The property $char_encodings is not named in camelCase.

This check marks property names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
4
{
5
    /**
6
     * @var array Character encodings to detect
7
     *
8
     * @see http://php.net/manual/en/function.mb-detect-order.php
9
     *
10
     * In practice, mb_detect_encoding can only successfully determine the
11
     * difference between the following common charsets at once without
12
     * breaking things for one of the other charsets:
13
     * - ASCII
14
     * - UTF-8
15
     * - SJIS
16
     * - EUC-JP
17
     *
18
     * If the array contains 'Windows-1252' special checking will be done
19
     * *after* all other encodings have failed. (Since it's likely to match
20
     * almost anything)
21
     *
22
     * The order of the charsets is significant. If you put UTF-8 before ASCII
23
     * it will never match ASCII, because UTF-8 is a superset of ASCII.
24
     * Similarly, SJIS and EUC-JP frequently match UTF-8 strings, so you should
25
     * check UTF-8 first. SJIS and EUC-JP seem to work either way, but SJIS is
26
     * more common so it should probably be first.
27
     *
28
     * Keep this behavior in mind when setting up your char_encodings array.
29
     *
30
     * Note that HHVM doesn't support SJIS or EUC-JP making them moot.
31
     */
32
    public static $char_encodings = array(
0 ignored issues
show
$char_encodings does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
33
        'ASCII',
34
        'UTF-8',
35
    );
36
37
    public $type = 'string';
38
    public $encoding = false;
39
    public $hints = array('string');
40
41
    public function getType()
42
    {
43
        if ($this->encoding === false) {
44
            return 'binary '.$this->type;
45
        } elseif ($this->encoding === 'ASCII') {
46
            return $this->type;
47
        } else {
48
            return $this->encoding.' '.$this->type;
49
        }
50
    }
51
52
    public function getValueShort()
53
    {
54
        if ($rep = $this->value) {
55
            return '"'.$rep->contents.'"';
56
        }
57
    }
58
59
    public function transplant(Kint_Object $new)
60
    {
61
        $new = parent::transplant($new);
0 ignored issues
show
Consider using a different name than the parameter $new. This often makes code more readable.
Loading history...
62
        $new->encoding = $this->encoding;
0 ignored issues
show
The property encoding does not seem to exist in Kint_Object.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
63
64
        return $new;
65
    }
66
67
    public static function strlen($string, $encoding = false)
68
    {
69 View Code Duplication
        if (extension_loaded('mbstring')) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
70
            if ($encoding === false) {
71
                $encoding = self::detectEncoding($string);
0 ignored issues
show
Consider using a different name than the parameter $encoding. This often makes code more readable.
Loading history...
72
            }
73
74
            if ($encoding && $encoding !== 'ASCII') {
75
                return mb_strlen($string, $encoding);
76
            }
77
        }
78
79
        return strlen($string);
80
    }
81
82
    public static function substr($string, $start, $length = null, $encoding = false)
83
    {
84 View Code Duplication
        if (extension_loaded('mbstring')) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
85
            if ($encoding === false) {
86
                $encoding = self::detectEncoding($string);
0 ignored issues
show
Consider using a different name than the parameter $encoding. This often makes code more readable.
Loading history...
87
            }
88
89
            if ($encoding && $encoding !== 'ASCII') {
90
                return mb_substr($string, $start, $length, $encoding);
91
            }
92
        }
93
94
        return substr($string, $start, isset($length) ? $length : PHP_INT_MAX);
95
    }
96
97
    public static function detectEncoding($string)
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
98
    {
99
        if (extension_loaded('mbstring')) {
100
            if ($ret = mb_detect_encoding($string, array_diff(self::$char_encodings, array('Windows-1252')), true)) {
101
                return $ret;
102
            } elseif (!in_array('Windows-1252', self::$char_encodings) || preg_match('/[\x00-\x08\x0B\x0C\x0E-\x1F\x81\x8D\x8F\x90\x9D]/', $string)) {
103
                return false;
104
            } else {
105
                return 'Windows-1252';
106
            }
107
        }
108
109
        if (!extension_loaded('iconv')) {
110
            return 'UTF-8';
111
        }
112
113
        $md5 = md5($string);
114
        foreach (self::$char_encodings as $encoding) {
115
            // fuck knows why, //IGNORE and //TRANSLIT still throw notice
116
            if (md5(@iconv($encoding, $encoding, $string)) === $md5) {
117
                return $encoding;
118
            }
119
        }
120
121
        return false;
122
    }
123
124
    public static function escape($string, $encoding = false)
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
125
    {
126
        static $show_dep = true;
127
128 View Code Duplication
        if ($show_dep) {
0 ignored issues
show
$show_dep does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
129
            trigger_error('Kint_Object_Blob::escape() is deprecated and will be removed in Kint 3.0. Use renderer-specific escape methods instead.', KINT_PHP53 ? E_USER_DEPRECATED : E_USER_NOTICE);
130
            $show_dep = false;
0 ignored issues
show
$show_dep does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
131
        }
132
133
        if (empty($string)) {
134
            return $string;
135
        }
136
137
        if (Kint::$enabled_mode === Kint::MODE_TEXT) {
138
            return $string;
139
        }
140
141
        if (Kint::$enabled_mode === Kint::MODE_CLI) {
142
            return str_replace("\x1b", '\\x1b', $string);
143
        }
144
145
        if ($encoding === false) {
146
            $encoding = self::detectEncoding($string);
0 ignored issues
show
Consider using a different name than the parameter $encoding. This often makes code more readable.
Loading history...
147
        }
148
149
        $original_encoding = $encoding;
0 ignored issues
show
$original_encoding does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
150
151
        if ($encoding === false || $encoding === 'ASCII') {
152
            $encoding = 'UTF-8';
0 ignored issues
show
Consider using a different name than the parameter $encoding. This often makes code more readable.
Loading history...
153
        }
154
155
        $string = htmlspecialchars($string, ENT_NOQUOTES, $encoding);
0 ignored issues
show
Consider using a different name than the parameter $string. This often makes code more readable.
Loading history...
156
157
        // this call converts all non-ASCII characters into numeirc htmlentities
158
        if ($original_encoding !== 'ASCII' && function_exists('mb_encode_numericentity')) {
0 ignored issues
show
$original_encoding does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
159
            $string = mb_encode_numericentity($string, array(0x80, 0xffff, 0, 0xffff), $encoding);
0 ignored issues
show
Consider using a different name than the parameter $string. This often makes code more readable.
Loading history...
160
        }
161
162
        return $string;
163
    }
164
}
165