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.
1 | <?php |
||
2 | |||
3 | /** |
||
4 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||
5 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||
6 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||
7 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||
8 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||
9 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||
10 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||
11 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||
12 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
13 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||
14 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
15 | * |
||
16 | * This software consists of voluntary contributions made by many individuals |
||
17 | * and is licensed under the LGPL. For more information please see |
||
18 | * <http://phing.info>. |
||
19 | */ |
||
20 | |||
21 | namespace Phing\Parser; |
||
22 | |||
23 | use Phing\Exception\BuildException; |
||
24 | use Phing\RuntimeConfigurable; |
||
25 | use Phing\Target; |
||
26 | use Phing\UnknownElement; |
||
27 | |||
28 | /** |
||
29 | * The generic element handler class. |
||
30 | * |
||
31 | * This class handles the occurrence of runtime registered tags like |
||
32 | * datatypes (fileset, patternset, etc) and it's possible nested tags. It |
||
33 | * introspects the implementation of the class and sets up the data structures. |
||
34 | * |
||
35 | * @author Michiel Rook <[email protected]> |
||
36 | * @copyright 2001,2002 THYRELL. All rights reserved |
||
37 | */ |
||
38 | class ElementHandler extends AbstractHandler |
||
39 | { |
||
40 | /** |
||
41 | * Reference to the parent object that represents the parent tag |
||
42 | * of this nested element. |
||
43 | * |
||
44 | * @var object |
||
45 | */ |
||
46 | private $parent; |
||
47 | |||
48 | /** |
||
49 | * Reference to the child object that represents the child tag |
||
50 | * of this nested element. |
||
51 | * |
||
52 | * @var UnknownElement |
||
53 | */ |
||
54 | private $child; |
||
55 | |||
56 | /** |
||
57 | * Reference to the parent wrapper object. |
||
58 | * |
||
59 | * @var RuntimeConfigurable |
||
60 | */ |
||
61 | private $parentWrapper; |
||
62 | |||
63 | /** |
||
64 | * Reference to the child wrapper object. |
||
65 | * |
||
66 | * @var RuntimeConfigurable |
||
67 | */ |
||
68 | private $childWrapper; |
||
69 | |||
70 | /** |
||
71 | * Reference to the related target object. |
||
72 | * |
||
73 | * @var Target the target instance |
||
74 | */ |
||
75 | private $target; |
||
76 | |||
77 | /** |
||
78 | * @var ProjectConfigurator |
||
79 | */ |
||
80 | private $configurator; |
||
81 | |||
82 | /** |
||
83 | * Constructs a new NestedElement handler and sets up everything. |
||
84 | * |
||
85 | * @param AbstractSAXParser $parser the ExpatParser object |
||
86 | * @param AbstractHandler $parentHandler the parent handler that invoked this handler |
||
87 | * @param ProjectConfigurator $configurator the ProjectConfigurator object |
||
88 | * @param UnknownElement $parent the parent object this element is contained in |
||
89 | * @param RuntimeConfigurable $parentWrapper the parent wrapper object |
||
90 | * @param Target $target the target object this task is contained in |
||
91 | */ |
||
92 | 901 | public function __construct( |
|
93 | AbstractSAXParser $parser, |
||
94 | AbstractHandler $parentHandler, |
||
95 | ProjectConfigurator $configurator, |
||
96 | ?UnknownElement $parent = null, |
||
97 | ?RuntimeConfigurable $parentWrapper = null, |
||
98 | ?Target $target = null |
||
99 | ) { |
||
100 | 901 | parent::__construct($parser, $parentHandler); |
|
101 | 901 | $this->configurator = $configurator; |
|
102 | 901 | if (null != $parentWrapper) { |
|
103 | 568 | $this->parent = $parentWrapper->getProxy(); |
|
104 | } else { |
||
105 | 901 | $this->parent = $parent; |
|
106 | } |
||
107 | 901 | $this->parentWrapper = $parentWrapper; |
|
108 | 901 | $this->target = $target; |
|
109 | } |
||
110 | |||
111 | /** |
||
112 | * Executes initialization actions required to setup the data structures |
||
113 | * related to the tag. |
||
114 | * <p> |
||
115 | * This includes: |
||
116 | * <ul> |
||
117 | * <li>creation of the nested element</li> |
||
118 | * <li>calling the setters for attributes</li> |
||
119 | * <li>adding the element to the container object</li> |
||
120 | * <li>adding a reference to the element (if id attribute is given)</li> |
||
121 | * </ul>. |
||
122 | * |
||
123 | * @param string $tag the tag that comes in |
||
124 | * @param array $attrs attributes the tag carries |
||
125 | * |
||
126 | * @throws ExpatParseException if the setup process fails |
||
127 | */ |
||
128 | 901 | public function init($tag, $attrs) |
|
129 | { |
||
130 | 901 | $configurator = $this->configurator; |
|
131 | 901 | $project = $this->configurator->project; |
|
132 | |||
133 | try { |
||
134 | 901 | $this->child = new UnknownElement(strtolower($tag)); |
|
135 | 901 | $this->child->setTaskName($tag); |
|
136 | 901 | $this->child->setTaskType($tag); |
|
137 | 901 | $this->child->setProject($project); |
|
138 | 901 | $this->child->setLocation($this->parser->getLocation()); |
|
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
139 | |||
140 | 901 | if (null !== $this->target) { |
|
141 | 901 | $this->child->setOwningTarget($this->target); |
|
142 | } |
||
143 | |||
144 | 901 | if (null !== $this->parent) { |
|
145 | 568 | $this->parent->addChild($this->child); |
|
146 | 901 | } elseif (null !== $this->target) { |
|
147 | 901 | $this->target->addTask($this->child); |
|
148 | } |
||
149 | |||
150 | 901 | $configurator->configureId($this->child, $attrs); |
|
151 | |||
152 | 901 | $this->childWrapper = new RuntimeConfigurable($this->child, $tag); |
|
153 | 901 | $this->childWrapper->setAttributes($attrs); |
|
154 | |||
155 | 901 | if (null !== $this->parentWrapper) { |
|
156 | 901 | $this->parentWrapper->addChild($this->childWrapper); |
|
157 | } |
||
158 | 1 | } catch (BuildException $exc) { |
|
159 | 1 | throw new ExpatParseException( |
|
160 | 1 | "Error initializing nested element <{$tag}>", |
|
161 | 1 | $exc, |
|
162 | 1 | $this->parser->getLocation() |
|
163 | 1 | ); |
|
164 | } |
||
165 | } |
||
166 | |||
167 | /** |
||
168 | * Handles character data. |
||
169 | * |
||
170 | * @param string $data the CDATA that comes in |
||
171 | * |
||
172 | * @throws ExpatParseException if the CDATA could not be set-up properly |
||
173 | */ |
||
174 | 771 | public function characters($data) |
|
175 | { |
||
176 | 771 | $this->childWrapper->addText($data); |
|
177 | } |
||
178 | |||
179 | /** |
||
180 | * Checks for nested tags within the current one. Creates and calls |
||
181 | * handlers respectively. |
||
182 | * |
||
183 | * @param string $name the tag that comes in |
||
184 | * @param array $attrs attributes the tag carries |
||
185 | */ |
||
186 | 568 | public function startElement($name, $attrs) |
|
187 | { |
||
188 | 568 | $eh = new ElementHandler( |
|
189 | 568 | $this->parser, |
|
190 | 568 | $this, |
|
191 | 568 | $this->configurator, |
|
192 | 568 | $this->child, |
|
193 | 568 | $this->childWrapper, |
|
194 | 568 | $this->target |
|
195 | 568 | ); |
|
196 | 568 | $eh->init($name, $attrs); |
|
197 | } |
||
198 | } |
||
199 |