Skip to content

Commit ac40fdc

Browse files
committed
MAGETWO-43599: Prepare Pull Request for Gallery Widget on Configurable Product
- Fix var parser
1 parent 4897c36 commit ac40fdc

File tree

1 file changed

+19
-2
lines changed
  • lib/internal/Magento/Framework/Config

1 file changed

+19
-2
lines changed

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ protected function _extractData(\DOMDocument $dom)
107107
}
108108

109109
/**
110+
* Recursive parser for <var> nodes
111+
*
110112
* @param \DOMElement $node
111-
* @return string|[]
113+
* @return string|boolean|number|null|[]
112114
*/
113115
protected function parseVarElement(\DOMElement $node)
114116
{
@@ -120,7 +122,22 @@ protected function parseVarElement(\DOMElement $node)
120122
}
121123
}
122124
if (!count($result)) {
123-
$result = $node->nodeValue;
125+
switch ($node->nodeValue) {
126+
case 'false':
127+
$result = false;
128+
break;
129+
case 'true':
130+
$result = true;
131+
break;
132+
case 'null':
133+
$result = null;
134+
break;
135+
default:
136+
$result = $node->nodeValue;
137+
if ($result == strval(floatval($result))) {
138+
$result = floatval($result);
139+
}
140+
};
124141
}
125142

126143
return $result;

0 commit comments

Comments
 (0)