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_Parser_Xml extends Kint_Parser_Plugin |
||
0 ignored issues
–
show
The property $parse_method 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 | * Which method to parse the variable with. |
||
7 | * |
||
8 | * DOMDocument provides more information including the text between nodes, |
||
9 | * however it's memory usage is very high and it takes longer to parse and |
||
10 | * render. Plus it's a pain to work with. So SimpleXML is the default. |
||
11 | * |
||
12 | * @var string |
||
13 | */ |
||
14 | public static $parse_method = 'SimpleXML'; |
||
0 ignored issues
–
show
$parse_method 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. ![]() |
|||
15 | |||
16 | public function getTypes() |
||
17 | { |
||
18 | return array('string'); |
||
19 | } |
||
20 | |||
21 | public function getTriggers() |
||
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 ![]() |
|||
22 | { |
||
23 | return Kint_Parser::TRIGGER_SUCCESS; |
||
24 | } |
||
25 | |||
26 | public function parse(&$var, Kint_Object &$o, $trigger) |
||
0 ignored issues
–
show
|
|||
27 | { |
||
28 | if (substr($var, 0, 5) !== '<?xml') { |
||
29 | return; |
||
30 | } |
||
31 | |||
32 | if (!method_exists(get_class($this), 'xmlTo'.self::$parse_method)) { |
||
33 | return; |
||
34 | } |
||
35 | |||
36 | $xml = call_user_func(array(get_class($this), 'xmlTo'.self::$parse_method), $var, $o->access_path); |
||
37 | |||
38 | if (empty($xml)) { |
||
39 | return; |
||
40 | } |
||
41 | |||
42 | list($xml, $access_path, $name) = $xml; |
||
0 ignored issues
–
show
$access_path 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. ![]() |
|||
43 | |||
44 | $base_obj = new Kint_Object(); |
||
0 ignored issues
–
show
$base_obj 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. ![]() |
|||
45 | $base_obj->depth = $o->depth + 1; |
||
0 ignored issues
–
show
$base_obj 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. ![]() |
|||
46 | $base_obj->name = $name; |
||
0 ignored issues
–
show
$base_obj 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. ![]() |
|||
47 | $base_obj->access_path = $access_path; |
||
0 ignored issues
–
show
$base_obj 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. ![]() |
|||
48 | |||
49 | $r = new Kint_Object_Representation('XML'); |
||
0 ignored issues
–
show
|
|||
50 | $r->contents = $this->parser->parse($xml, $base_obj); |
||
0 ignored issues
–
show
$base_obj 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. ![]() It seems like
$this->parser->parse($xml, $base_obj) of type object<Kint_Object> is incompatible with the declared type array of property $contents .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
51 | |||
52 | $o->addRepresentation($r, 0); |
||
53 | } |
||
54 | |||
55 | protected static function xmlToSimpleXML($var, $parent_path) |
||
0 ignored issues
–
show
$parent_path 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. ![]() The parameter $parent_path is not named in camelCase.
This check marks parameter 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 ![]() |
|||
56 | { |
||
57 | try { |
||
58 | $errors = libxml_use_internal_errors(true); |
||
59 | $xml = simplexml_load_string($var); |
||
60 | libxml_use_internal_errors($errors); |
||
61 | } catch (Exception $e) { |
||
62 | if (isset($errors)) { |
||
63 | libxml_use_internal_errors($errors); |
||
64 | } |
||
65 | |||
66 | return; |
||
67 | } |
||
68 | |||
69 | if (!$xml) { |
||
70 | return; |
||
71 | } |
||
72 | |||
73 | View Code Duplication | if ($parent_path === null) { |
|
0 ignored issues
–
show
$parent_path 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. ![]() |
|||
74 | $access_path = null; |
||
0 ignored issues
–
show
$access_path 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. ![]() |
|||
75 | } else { |
||
76 | $access_path = 'simplexml_load_string('.$parent_path.')'; |
||
0 ignored issues
–
show
$access_path 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. ![]() |
|||
77 | } |
||
78 | |||
79 | $name = $xml->getName(); |
||
80 | |||
81 | return array($xml, $access_path, $name); |
||
0 ignored issues
–
show
$access_path 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. ![]() |
|||
82 | } |
||
83 | |||
84 | /** |
||
85 | * Get the DOMDocument info. |
||
86 | * |
||
87 | * The documentation of DOMDocument::loadXML() states that while you can |
||
88 | * call it statically, it will give an E_STRICT warning. On my system it |
||
89 | * actually gives an E_DEPRECATED warning, but it works so we'll just add |
||
90 | * an error-silencing '@' to the access path. |
||
91 | * |
||
92 | * If it errors loading then we wouldn't have gotten this far in the first place. |
||
93 | * |
||
94 | * @param string $var The XML string |
||
95 | * @param string $parent_path The path to the parent, in this case the XML string |
||
96 | * |
||
97 | * @return array The root element DOMNode, the access path, and the root element name |
||
0 ignored issues
–
show
|
|||
98 | */ |
||
99 | protected static function xmlToDOMDocument($var, $parent_path) |
||
0 ignored issues
–
show
$parent_path 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. ![]() The parameter $parent_path is not named in camelCase.
This check marks parameter 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 ![]() |
|||
100 | { |
||
101 | // There's no way to check validity in DOMDocument without making errors. For shame! |
||
102 | if (!self::xmlToSimpleXML($var, $parent_path)) { |
||
0 ignored issues
–
show
$parent_path 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. ![]() |
|||
103 | return; |
||
104 | } |
||
105 | |||
106 | $xml = new DOMDocument(); |
||
107 | $xml->loadXML($var); |
||
108 | $xml = $xml->firstChild; |
||
109 | |||
110 | View Code Duplication | if ($parent_path === null) { |
|
0 ignored issues
–
show
$parent_path 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. ![]() |
|||
111 | $access_path = null; |
||
0 ignored issues
–
show
$access_path 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. ![]() |
|||
112 | } else { |
||
113 | $access_path = '@DOMDocument::loadXML('.$parent_path.')->firstChild'; |
||
0 ignored issues
–
show
$access_path 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. ![]() |
|||
114 | } |
||
115 | |||
116 | $name = $xml->nodeName; |
||
117 | |||
118 | return array($xml, $access_path, $name); |
||
0 ignored issues
–
show
$access_path 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. ![]() |
|||
119 | } |
||
120 | } |
||
121 |
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.