Skip to content

Commit 2d24121

Browse files
author
Oleksii Korshenko
authored
MAGETWO-66795: Fix merging nested <var /> in view.xml #7556
2 parents 9e79a47 + a5c13c4 commit 2d24121

File tree

4 files changed

+27
-26
lines changed

4 files changed

+27
-26
lines changed

lib/internal/Magento/Framework/Config/View.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ protected function getIdAttributes()
152152
{
153153
$idAttributes = [
154154
'/view/vars' => 'module',
155-
'/view/vars/var' => 'name',
155+
'/view/vars/(var/)*var' => 'name',
156156
'/view/exclude/item' => ['type', 'item'],
157157
];
158158
foreach ($this->xpath as $attribute) {

lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/_files/invalidConfigXmlArray.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@
178178
</config>',
179179
[
180180
"Element 'virtualType', attribute 'name': [facet 'pattern'] The value '' is not accepted by the pattern '" .
181-
"([a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*" .
182-
")*'." .
181+
"(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
182+
"(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
183183
"\nLine: 2\n",
184184
"Element 'virtualType', attribute 'name': '' is not a valid value of the atomic type 'phpClassName'." .
185185
"\nLine: 2\n",
@@ -188,32 +188,14 @@
188188
"\nLine: 2\n",
189189
],
190190
],
191-
'virtualtype with invalid_name' => [
192-
'<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
193-
<virtualType name="\\BackslashPrefix\\IsNotAllowed" type="TypeName" shared="true"/>
194-
</config>',
195-
[
196-
"Element 'virtualType', attribute 'name': [facet 'pattern'] The value '\\BackslashPrefix\\IsNotAllowed' " .
197-
"is not accepted by the pattern '" .
198-
"([a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*" .
199-
")*'." .
200-
"\nLine: 2\n",
201-
"Element 'virtualType', attribute 'name': '\\BackslashPrefix\\IsNotAllowed' " .
202-
"is not a valid value of the atomic type 'phpClassName'." .
203-
"\nLine: 2\n",
204-
"Element 'virtualType', attribute 'name': Warning: No precomputed value available, the value was either " .
205-
"invalid or something strange happend." .
206-
"\nLine: 2\n",
207-
],
208-
],
209191
'virtualtype with empty_type' => [
210192
'<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
211193
<virtualType name="Name" type="" shared="true"/>
212194
</config>',
213195
[
214196
"Element 'virtualType', attribute 'type': [facet 'pattern'] The value '' is not accepted by the pattern '" .
215-
"([a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*" .
216-
")*'." .
197+
"(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
198+
"(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
217199
"\nLine: 2\n",
218200
"Element 'virtualType', attribute 'type': '' is not a valid value of the atomic type 'phpClassName'." .
219201
"\nLine: 2\n",
@@ -226,8 +208,8 @@
226208
[
227209
"Element 'virtualType', attribute 'name': [facet 'pattern'] The value '777Digits\\IsNotAllowed' " .
228210
"is not accepted by the pattern '" .
229-
"([a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*" .
230-
")*'." .
211+
"(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
212+
"(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
231213
"\nLine: 2\n",
232214
"Element 'virtualType', attribute 'name': '777Digits\\IsNotAllowed' " .
233215
"is not a valid value of the atomic type 'phpClassName'." .
@@ -237,4 +219,22 @@
237219
"\nLine: 2\n",
238220
],
239221
],
222+
'virtualtype with digits_and_prefix_slash' => [
223+
'<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
224+
<virtualType name="\\777Digits\\IsNotAllowed" type="TypeName" shared="true"/>
225+
</config>',
226+
[
227+
"Element 'virtualType', attribute 'name': [facet 'pattern'] The value '\\777Digits\\IsNotAllowed' " .
228+
"is not accepted by the pattern '" .
229+
"(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
230+
"(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
231+
"\nLine: 2\n",
232+
"Element 'virtualType', attribute 'name': '\\777Digits\\IsNotAllowed' " .
233+
"is not a valid value of the atomic type 'phpClassName'." .
234+
"\nLine: 2\n",
235+
"Element 'virtualType', attribute 'name': Warning: No precomputed value available, the value was either " .
236+
"invalid or something strange happend." .
237+
"\nLine: 2\n",
238+
],
239+
],
240240
];

lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/_files/valid_config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,5 @@
6464
</argument>
6565
</arguments>
6666
</type>
67+
<virtualType name="\BackslashPrefix\IsAllowed" type="TypeName" shared="true"/>
6768
</config>

lib/internal/Magento/Framework/ObjectManager/etc/config.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</xs:documentation>
3737
</xs:annotation>
3838
<xs:restriction base="xs:string">
39-
<xs:pattern value="([a-zA-Z_&#x7f;-&#xff;][a-zA-Z0-9_&#x7f;-&#xff;]*)(\\[a-zA-Z_&#x7f;-&#xff;][a-zA-Z0-9_&#x7f;-&#xff;]*)*"/>
39+
<xs:pattern value="(\\?[a-zA-Z_&#x7f;-&#xff;][a-zA-Z0-9_&#x7f;-&#xff;]*)(\\[a-zA-Z_&#x7f;-&#xff;][a-zA-Z0-9_&#x7f;-&#xff;]*)*"/>
4040
</xs:restriction>
4141
</xs:simpleType>
4242

0 commit comments

Comments
 (0)