Skip to content

Commit

Permalink
Merge pull request #13 from benlumley/master
Browse files Browse the repository at this point in the history
Fix for unterminated entity references
  • Loading branch information
Sibyx authored Aug 20, 2017
2 parents bc6e257 + 552da44 commit 71e92e7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/phpGPX/Parsers/MetadataParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ public static function toXML(Metadata $metadata, \DOMDocument &$document)
$child = ExtensionParser::toXML($metadata->extensions, $document);
break;
default:
$child = $document->createElement($key, $metadata->{$attribute['name']});
$child = $document->createElement($key);
$elementText = $document->createTextNode((string) $metadata->{$attribute['name']});
$child->appendChild($elementText);
break;
}

Expand All @@ -155,4 +157,4 @@ public static function toXML(Metadata $metadata, \DOMDocument &$document)
return $node;
}

}
}
7 changes: 5 additions & 2 deletions src/phpGPX/Parsers/PointParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ public static function toXML(Point $point, \DOMDocument &$document)
$child = ExtensionParser::toXML($point->extensions, $document);
break;
default:
$child = $document->createElement($key, $point->{$attribute['name']});
$child = $document->createElement($key);
$elementText = $document->createTextNode((string) $point->{$attribute['name']});
$child->appendChild($elementText);
break;
break;
}

Expand Down Expand Up @@ -203,4 +206,4 @@ public static function toXMLArray(array $points, \DOMDocument &$document)
return $result;
}

}
}
6 changes: 4 additions & 2 deletions src/phpGPX/Parsers/RouteParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ public static function toXML(Route $route, \DOMDocument &$document)
$child = PointParser::toXMLArray($route->points, $document);
break;
default:
$child = $document->createElement($key, $route->{$attribute['name']});
$child = $document->createElement($key);
$elementText = $document->createTextNode((string) $route->{$attribute['name']});
$child->appendChild($elementText);
break;
}

Expand Down Expand Up @@ -169,4 +171,4 @@ public static function toXMLArray(array $routes, \DOMDocument &$document)

return $result;
}
}
}
6 changes: 4 additions & 2 deletions src/phpGPX/Parsers/TrackParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ public static function toXML(Track $track, \DOMDocument &$document)
$child = SegmentParser::toXMLArray($track->segments, $document);
break;
default:
$child = $document->createElement($key, $track->{$attribute['name']});
$child = $document->createElement($key);
$elementText = $document->createTextNode((string) $track->{$attribute['name']});
$child->appendChild($elementText);
break;
}

Expand Down Expand Up @@ -170,4 +172,4 @@ public static function toXMLArray(array $tracks, \DOMDocument &$document)

return $result;
}
}
}

0 comments on commit 71e92e7

Please sign in to comment.