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_BlobTest extends KintTestCase |
||
0 ignored issues
–
show
|
|||
4 | { |
||
5 | public function blobProvider() |
||
6 | { |
||
7 | $p = new Kint_Parser(); |
||
0 ignored issues
–
show
|
|||
8 | $b = Kint_Object::blank('$v'); |
||
0 ignored issues
–
show
|
|||
9 | |||
10 | Kint_Object_Blob::$char_encodings = array( |
||
11 | 'ASCII', |
||
12 | 'UTF-8', |
||
13 | ); |
||
14 | |||
15 | $strings = array( |
||
16 | 'empty' => array( |
||
17 | '', |
||
18 | 'ASCII', |
||
19 | 'string', |
||
20 | ), |
||
21 | 'ASCII' => array( |
||
22 | "The quick brown fox jumps<br>\r\n\tover the lazy dog", |
||
23 | 'ASCII', |
||
24 | 'string', |
||
25 | ), |
||
26 | 'UTF-8' => array( |
||
27 | "El zorro marrón rápido salta sobre<br>\r\n\tel perro perezoso", |
||
28 | 'UTF-8', |
||
29 | 'UTF-8 string', |
||
30 | ), |
||
31 | 'fail' => array( |
||
32 | "The quick brown fox jumps<br>\r\n\tover the lazy dog\x90\x1b", |
||
33 | false, |
||
34 | 'binary string', |
||
35 | ), |
||
36 | ); |
||
37 | |||
38 | if (!defined('HHVM_VERSION')) { |
||
39 | Kint_Object_Blob::$char_encodings[] = 'SJIS'; |
||
40 | Kint_Object_Blob::$char_encodings[] = 'EUC-JP'; |
||
41 | Kint_Object_Blob::$char_encodings[] = 'Windows-1252'; |
||
42 | $strings['SJIS'] = array( |
||
43 | mb_convert_encoding("ã‚ント最強<br>\r\n\tASCII", 'SJIS', 'UTF-8'), |
||
44 | 'SJIS', |
||
45 | 'SJIS string', |
||
46 | ); |
||
47 | $strings['EUC-JP'] = array( |
||
48 | mb_convert_encoding("ã‚ント最強<br>\r\n\tASCII", 'EUC-JP', 'UTF-8'), |
||
49 | 'EUC-JP', |
||
50 | 'EUC-JP string', |
||
51 | ); |
||
52 | $strings['yuck'] = array( |
||
53 | mb_convert_encoding("El zorro marrón rápido salta sobre<br>\r\n\tel perro perezoso", 'Windows-1252', 'UTF-8'), |
||
54 | 'Windows-1252', |
||
55 | 'Windows-1252 string', |
||
56 | ); |
||
57 | } |
||
58 | |||
59 | foreach ($strings as $encoding => &$string) { |
||
60 | array_unshift($string, $p->parse($string[0], clone $b)); |
||
61 | } |
||
62 | |||
63 | return $strings; |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * @dataProvider blobProvider |
||
68 | */ |
||
69 | public function testGetType(Kint_Object_Blob $object, $string, $encoding, $type) |
||
0 ignored issues
–
show
|
|||
70 | { |
||
71 | $this->assertEquals($type, $object->getType()); |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * @dataProvider blobProvider |
||
76 | */ |
||
77 | public function testGetValueShort(Kint_Object_Blob $object, $string, $encoding) |
||
78 | { |
||
79 | if ($encoding) { |
||
80 | $string = mb_convert_encoding($string, 'UTF-8', $encoding); |
||
0 ignored issues
–
show
|
|||
81 | $string = '"'.$string.'"'; |
||
0 ignored issues
–
show
|
|||
82 | $string = mb_convert_encoding($string, $encoding, 'UTF-8'); |
||
0 ignored issues
–
show
|
|||
83 | } else { |
||
84 | $string = '"'.$string.'"'; |
||
0 ignored issues
–
show
|
|||
85 | } |
||
86 | |||
87 | $this->assertEquals($string, $object->getValueShort()); |
||
88 | } |
||
89 | |||
90 | public function testTransplant() |
||
91 | { |
||
92 | $p = new Kint_Parser(); |
||
0 ignored issues
–
show
|
|||
93 | $b = Kint_Object::blank('$v'); |
||
0 ignored issues
–
show
|
|||
94 | |||
95 | $string = 'How now brown cow'; |
||
96 | |||
97 | $o = $p->parse($string, clone $b); |
||
0 ignored issues
–
show
|
|||
98 | |||
99 | $this->assertNotFalse($o->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. ![]() |
|||
100 | $this->assertNotNull($o->encoding); |
||
101 | $this->assertNotEmpty($o->encoding); |
||
102 | |||
103 | $o2 = $o->transplant(new Kint_Object_Blob()); |
||
0 ignored issues
–
show
|
|||
104 | |||
105 | $o->hints[] = 'string'; |
||
106 | |||
107 | $this->assertEquals($o, $o2); |
||
108 | $this->assertNotSame($o, $o2); |
||
109 | $this->assertSame($o->encoding, $o2->encoding); |
||
110 | } |
||
111 | |||
112 | /** |
||
113 | * @dataProvider blobProvider |
||
114 | */ |
||
115 | public function testStrlen(Kint_Object_Blob $object, $string, $encoding) |
||
0 ignored issues
–
show
|
|||
116 | { |
||
117 | if ($encoding === false) { |
||
118 | $this->assertEquals(strlen($string), Kint_Object_Blob::strlen($string)); |
||
119 | $this->assertEquals(strlen($string), Kint_Object_Blob::strlen($string, false)); |
||
120 | } else { |
||
121 | $this->assertEquals(mb_strlen($string, $encoding), Kint_Object_Blob::strlen($string)); |
||
122 | $this->assertEquals(mb_strlen($string, $encoding), Kint_Object_Blob::strlen($string, $encoding)); |
||
123 | } |
||
124 | } |
||
125 | |||
126 | /** |
||
127 | * @dataProvider blobProvider |
||
128 | */ |
||
129 | public function testDetectEncoding(Kint_Object_Blob $object, $string, $encoding) |
||
0 ignored issues
–
show
|
|||
130 | { |
||
131 | $this->assertEquals($encoding, Kint_Object_Blob::detectEncoding($string)); |
||
132 | } |
||
133 | |||
134 | /** |
||
135 | * @dataProvider blobProvider |
||
136 | * @expectedException \PHPUnit_Framework_Error_Deprecated |
||
137 | */ |
||
138 | public function testEscapeText(Kint_Object_Blob $object, $string, $encoding) |
||
0 ignored issues
–
show
|
|||
139 | { |
||
140 | Kint::$enabled_mode = Kint::MODE_TEXT; |
||
141 | |||
142 | $this->assertEquals($string, Kint_Object_Blob::escape($string, $encoding)); |
||
143 | } |
||
144 | |||
145 | /** |
||
146 | * @dataProvider blobProvider |
||
147 | * @expectedException \PHPUnit_Framework_Error_Deprecated |
||
148 | */ |
||
149 | public function testEscapeTextNoEncoding(Kint_Object_Blob $object, $string) |
||
0 ignored issues
–
show
|
|||
150 | { |
||
151 | Kint::$enabled_mode = Kint::MODE_TEXT; |
||
152 | |||
153 | $this->assertEquals($string, Kint_Object_Blob::escape($string)); |
||
154 | } |
||
155 | |||
156 | /** |
||
157 | * @dataProvider blobProvider |
||
158 | * @expectedException \PHPUnit_Framework_Error_Deprecated |
||
159 | */ |
||
160 | public function testEscapeCli(Kint_Object_Blob $object, $string, $encoding) |
||
0 ignored issues
–
show
|
|||
161 | { |
||
162 | Kint::$enabled_mode = Kint::MODE_CLI; |
||
163 | |||
164 | $this->assertNotContains("\x1b", Kint_Object_Blob::escape($string, $encoding)); |
||
165 | } |
||
166 | |||
167 | /** |
||
168 | * @dataProvider blobProvider |
||
169 | * @expectedException \PHPUnit_Framework_Error_Deprecated |
||
170 | */ |
||
171 | public function testEscapeCliNoEncoding(Kint_Object_Blob $object, $string) |
||
0 ignored issues
–
show
|
|||
172 | { |
||
173 | Kint::$enabled_mode = Kint::MODE_CLI; |
||
174 | |||
175 | $this->assertNotContains("\x1b", Kint_Object_Blob::escape($string)); |
||
176 | } |
||
177 | |||
178 | /** |
||
179 | * @dataProvider blobProvider |
||
180 | * @expectedException \PHPUnit_Framework_Error_Deprecated |
||
181 | */ |
||
182 | public function testEscapeHtml(Kint_Object_Blob $object, $string, $encoding) |
||
0 ignored issues
–
show
|
|||
183 | { |
||
184 | Kint::$enabled_mode = Kint::MODE_RICH; |
||
185 | |||
186 | if ($encoding === false || $encoding === 'ASCII') { |
||
187 | $new_encoding = 'UTF-8'; |
||
0 ignored issues
–
show
$new_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. ![]() |
|||
188 | } else { |
||
189 | $new_encoding = $encoding; |
||
0 ignored issues
–
show
$new_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. ![]() |
|||
190 | } |
||
191 | |||
192 | $expect = htmlspecialchars($string, ENT_NOQUOTES, $new_encoding); |
||
0 ignored issues
–
show
$new_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. ![]() |
|||
193 | $expect = mb_encode_numericentity($expect, array(0x80, 0xffff, 0, 0xffff), $new_encoding); |
||
0 ignored issues
–
show
$new_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. ![]() |
|||
194 | |||
195 | $this->assertEquals($expect, Kint_Object_Blob::escape($string, $encoding)); |
||
196 | } |
||
197 | } |
||
198 |
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.