(bug 34666) Escape URLs in XML files created by generateSitemap.php
authorLiangent <liangent@gmail.com>
Sun, 12 May 2013 15:36:59 +0000 (15:36 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 12 May 2013 17:10:39 +0000 (17:10 +0000)
Bug: 34666
Change-Id: Ifb6ddb0bc6ca03c411f938837b2f89a5a30e4fc3

maintenance/generateSitemap.php

index 75907ad..86fb97a 100644 (file)
@@ -490,7 +490,8 @@ class GenerateSitemap extends Maintenance {
        function fileEntry( $url, $date, $priority ) {
                return
                        "\t<url>\n" .
-                       "\t\t<loc>$url</loc>\n" .
+                       // bug 34666: $url may contain bad characters such as ampersands.
+                       "\t\t<loc>" . htmlspecialchars( $url ) . "</loc>\n" .
                        "\t\t<lastmod>$date</lastmod>\n" .
                        "\t\t<priority>$priority</priority>\n" .
                        "\t</url>\n";