Commit:    e9b937bb165a27b04149d9a8f0921fb3441afd05
Author:    Christoph M. Becker <cmbecke...@gmx.de>         Tue, 24 Jul 2018 
14:55:38 +0200
Parents:   e11c6cc36b49b56dbc049e98c06985a27f6849a5
Branches:  master

Link:       
http://git.php.net/?p=web/bugs.git;a=commitdiff;h=e9b937bb165a27b04149d9a8f0921fb3441afd05

Log:
Fix rss/bug.php?format=xml

Although, `MDB2_FETCHMODE_ASSOC` is supposed to return an associative
array (mapping column names to their values)[1], for some reason it
actually seems to behave like some non-existing `MDB2_FETCHMODE_BOTH`.
This breaks the generated XML by additionally creating invalid element
names.  Since we are not sure whether other callers of bugs_get_bug()
and bugs_get_bug_comments() rely on this behavior, we're working around
the issue by skipping the integer keys.

[1] 
<http://pear.php.net/manual/en/package.database.mdb2.intro-fetch.php#package.database.mdb2.intro-fetch.desc.format>

Changed paths:
  M  www/rss/xml.php


Diff:
diff --git a/www/rss/xml.php b/www/rss/xml.php
index 8aad78e..eebdae4 100644
--- a/www/rss/xml.php
+++ b/www/rss/xml.php
@@ -1,12 +1,14 @@
 <?php
 echo "<bug>\n";
 foreach ($bug as $key => $value) {
+       if (is_int($key)) continue;
        echo "  <$key>", clean($value), "</$key>\n";
 }
 foreach ($comments as $comment) {
        if (empty($comment['registered'])) continue;
        echo "  <comment>\n";
        foreach ($comment as $key => $value) {
+               if (is_int($key)) continue;
                echo "  <$key>", clean($value), "</$key>\n";
        }
        echo "  </comment>\n";


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to