| @@ -50,15 +50,16 @@ | ||
| 50 | 50 | return $target; |
| 51 | 51 | } |
| 52 | 52 | private function memberKey(Shape $shape, $name) |
| 53 | 53 | { |
| 54 | - if (null !== $shape['locationName']) { | |
| 55 | - return $shape['locationName']; | |
| 54 | + // Check if locationName came from shape definition | |
| 55 | + if ($shape instanceof StructureShape && isset($shape['locationName'])) { | |
| 56 | + $originalDef = $shape->getOriginalDefinition($shape->getName()); | |
| 57 | + if ($originalDef && isset($originalDef['locationName']) && $originalDef['locationName'] === $shape['locationName']) { | |
| 58 | + return $name; | |
| 59 | + } | |
| 56 | 60 | } |
| 57 | - if ($shape instanceof ListShape && $shape['flattened']) { | |
| 58 | - return $shape->getMember()['locationName'] ?: $name; | |
| 59 | - } | |
| 60 | - return $name; | |
| 61 | + return $shape['locationName'] ?? $name; | |
| 61 | 62 | } |
| 62 | 63 | private function parse_list(ListShape $shape, \SimpleXMLElement $value) |
| 63 | 64 | { |
| 64 | 65 | $target = []; |
| @@ -93,9 +94,13 @@ | ||
| 93 | 94 | return \base64_decode((string) $value); |
| 94 | 95 | } |
| 95 | 96 | private function parse_float(Shape $shape, $value) |
| 96 | 97 | { |
| 97 | - return (float) (string) $value; | |
| 98 | + $value = (string) $value; | |
| 99 | + return match ($value) { | |
| 100 | + 'NaN', 'Infinity', '-Infinity' => $value, | |
| 101 | + default => (float) $value, | |
| 102 | + }; | |
| 98 | 103 | } |
| 99 | 104 | private function parse_integer(Shape $shape, $value) |
| 100 | 105 | { |
| 101 | 106 | return (int) (string) $value; |
| @@ -112,10 +117,10 @@ | ||
| 112 | 117 | throw new ParserException('Invalid timestamp value passed to XmlParser::parse_timestamp'); |
| 113 | 118 | } |
| 114 | 119 | private function parse_xml_attribute(Shape $shape, Shape $memberShape, $value) |
| 115 | 120 | { |
| 116 | - $namespace = $shape['xmlNamespace']['uri'] ? $shape['xmlNamespace']['uri'] : ''; | |
| 117 | - $prefix = $shape['xmlNamespace']['prefix'] ? $shape['xmlNamespace']['prefix'] : ''; | |
| 121 | + $namespace = $shape['xmlNamespace']['uri'] ?? ''; | |
| 122 | + $prefix = $shape['xmlNamespace']['prefix'] ?? ''; | |
| 118 | 123 | if (!empty($prefix)) { |
| 119 | 124 | $prefix .= ':'; |
| 120 | 125 | } |
| 121 | 126 | $key = \str_replace($prefix, '', $memberShape['locationName']); |