This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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
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 ![]() |
|||
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. ![]() |
|||
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
|
|||
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. ![]() |
|||
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. ![]() |
|||
70 | if ($encoding === false) { |
||
71 | $encoding = self::detectEncoding($string); |
||
0 ignored issues
–
show
|
|||
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. ![]() |
|||
85 | if ($encoding === false) { |
||
86 | $encoding = self::detectEncoding($string); |
||
0 ignored issues
–
show
|
|||
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 ![]() |
|||
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 ![]() |
|||
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. ![]() 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. ![]() |
|||
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. ![]() |
|||
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
|
|||
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. ![]() |
|||
150 | |||
151 | if ($encoding === false || $encoding === 'ASCII') { |
||
152 | $encoding = 'UTF-8'; |
||
0 ignored issues
–
show
|
|||
153 | } |
||
154 | |||
155 | $string = htmlspecialchars($string, ENT_NOQUOTES, $encoding); |
||
0 ignored issues
–
show
|
|||
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. ![]() |
|||
159 | $string = mb_encode_numericentity($string, array(0x80, 0xffff, 0, 0xffff), $encoding); |
||
0 ignored issues
–
show
|
|||
160 | } |
||
161 | |||
162 | return $string; |
||
163 | } |
||
164 | } |
||
165 |
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.