Opened 13 years ago
Closed 12 years ago
#4315 closed defect (bug) (fixed)
XML feeds not working
Reported by: | mnelson4 | Owned by: | fanquake |
---|---|---|---|
Milestone: | 1.7 | Priority: | normal |
Severity: | normal | Version: | 1.5.4 |
Component: | Activity | Keywords: | has-patch reporter-feedback |
Cc: | fanquake@… |
Description
I'm using buddypress 1.5.4 and was getting the following error when subscribing to any of the RSS feeds:
"This page contains the following errors: error on line 2 at column 6: XML declaration allowed only at the start of the document"
(in Chrome, in Safari I was getting a different error).
I inspected the feed's source and indeed found an extra blank line before the XML version declaration, which was invalidating the XML feed. So I hunted about, and found these blank lines at the start of the RSS feed files themselves (in buddypress/bp-activity/feeds). They occur at these lines:
header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
header('Status: 200 OK');
?>
<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
So I removed the extra line break to make the code look like this:
header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
header('Status: 200 OK');
echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
And it got rid of the error for me! Maybe you'll want to incorporate this change into newer versions?
Good catch. Let's do this right after 1.6.