WordPress.org

Make WordPress Core

Opened 11 years ago

Closed 6 years ago

Last modified 3 months ago

#108 closed defect (bug) (fixed)

I get an XML Parsing Error whenever i got to my journals rss feeds

Reported by: anonymousbugger Owned by: ryan
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.7
Component: XML-RPC Keywords: has-patch tested
Focuses: Cc:

Description

Whenever i click on the rss feeds for journal and comments i get an error message and i can't get it fixed. This is preventing bots and other things from indexing my journal. The error is displayed below.
XML Parsing Error: xml processing instruction not at start of external entity
Location: http://chenu.uni.cc/wp-rss2.php
Line Number 1, Column 2: <?xml version="1.0" encoding="utf-8"?>
-

Attachments (2)

0000108-wp-rss2.php (1.8 KB) - added by anonymousbugger 10 years ago.
108.diff (2.6 KB) - added by Denis-de-Bernardy 6 years ago.

Download all attachments as: .zip

Change History (20)

comment:2 @Sebbi11 years ago

What programm are you using? I had a similar problem with IE 6.0 am german "umlauts" ...

comment:3 @michel v11 years ago

This is not about umlauts.
It's about <?xml being preceded by a space character.

Make sure you're using the wp-rss2.php file from a fresh install and that you did not edit it in any way.

comment:4 @davidhouse11 years ago

It seems that something, somewhere, is echoing a space before the <?xml ?> processing entity. Have a look through your wp-blog-header.php file, that's the only other file being included.

Or, if you have a particulary strict PHP running on your server, it could be the line break before the line

<?php echo '<?xml version="1.0" encoding="' . $charset . '"?'.'>'; ?>

on line 13.

edited on: 06-22-04 16:33

comment:5 @anonymousbugger11 years ago

Patch for that bug:

sh-2.05b# diff --rcs wp-rss2.php wp-rss2.php.patched
d12 2
a13 1
echo '<?xml version="1.0" encoding="' . $charset . '"?'.'>'; ?>

This occurs in several of the xml generating files.

comment:6 @lowmagnet11 years ago

(I added the previous bugnote as well)

I removed the extra line-feed in the rss2 file (and all others using this same code) and it still is placing a line-feed in the content before that point. I'm tracking the code through the all of the various includes/requires to track this further.

OK, I found that the 'weekday' plugin was also adding a new-line character. All plugin developers should probably be informed that adding new-lines in their code (usually by ending or starting their main php with a trailing or leading new-line) can screw up xml parsing.

edited on: 07-08-04 14:42

comment:7 @matt11 years ago

I get this error when visiting that URI:

Warning: Unknown(): Unable to access c:\domains\chenu.uni.cc\wwwroot\wp-rss2.php in Unknown on line 0

Warning: Unknown(c:\domains\chenu.uni.cc\wwwroot\wp-rss2.php): failed to open stream: No such file or directory in Unknown on line 0

Warning: Unknown(): Unable to access c:\domains\chenu.uni.cc\wwwroot\wp-rss2.php in Unknown on line 0

Warning: Unknown(c:\domains\chenu.uni.cc\wwwroot\wp-rss2.php): failed to open stream: No such file or directory in Unknown on line 0

Warning: (null)(): Failed opening 'c:\domains\chenu.uni.cc\wwwroot\wp-rss2.php' for inclusion (include_path='.;c:\php\includes') in Unknown on line 0

Anyway this error is probably related to a bad plugin.

edited on: 07-08-04 15:25

comment:8 @ryan10 years ago

  • Owner changed from anonymous to rboren
  • Resolution changed from 10 to 70
  • Status changed from new to closed

comment:9 @anonymousbugger10 years ago

  • Patch set to No
  • Resolution changed from 70 to 30
  • Status changed from closed to assigned

I am running Win2K, php version 4.3.9, MySQL version 4.0.18, wordpress version 1.2.2

Neither of the following files will open in firefox0.8 and NS7,

wp-rss2.php
wp-commentsrss2.php

I get the following error message:


"XML Parsing Error: xml processing instruction not at start of external entity"
Location: [...] wp-rss2.php
Line Number 2, Column 1:
<?xml version="1.0" encoding="utf-8"?>


No error is produced in IE6 or Opera7.

I have searched the wordpress support forums and see that this is not an uncommon problem. I have tried to find a way to remove the space before "<?xml" but being brand new to php, really do not understand enough about php coding to get very far at all. I do not see a solution that I understand listed there.

I hope this is enough but not too much information.

-ejm

edited on: 02-04-05 22:12

comment:10 @anonymousbugger10 years ago

I located a fix for this in the wordpress support forums
http://wordpress.org/support/topic.php?id=13097


for rss2 - open the file wp-rss2.php from the wp root
for commentsrss2 - open file pwp-commentsrss2.php from wp root

find

header('Content-type: text/xml', true);

and replace with

header('Content-type: application/xml', true);


This has resolved the problem for wp-rss2.php and wp-commentsrss2.php and this issue is now mostly resolved. Thank you.

-ejm

edit: the fix does not appear to work for wp-rss.php

edited on: 02-05-05 10:35

edited on: 02-05-05 10:46

comment:11 follow-up: @matt10 years ago

  • Resolution changed from 30 to 50
  • Status changed from assigned to closed

Without fail this is ALWAYS due to a plugin extra whitespace or whitespace in a user-edited file like wp-config.php.

comment:12 in reply to: ↑ 11 @cbanack6 years ago

  • Cc cbanack added
  • Resolution wontfix deleted
  • Severity changed from critical to normal
  • Status changed from closed to reopened
  • Version changed from 1.2 to 2.7

This issue only happens to some people, some of the time, but it is definitely still alive and well in the latest version of Wordpress. As mentioned, it is due to extra whitespace being introduced by plugins and user edits--something that the average user will probably never diagnose or fix on their own.

Fortunately, there is a very easy patch that can be added to WordPress that will get rid of this problem for good, for everyone. I've described that patch here (before I knew there was a trac site that I could use):

http://wordpress.org/support/topic/241004

Please consider merging this patch into the main WordPress codebase.

comment:13 @DD326 years ago

WordPress cant help with dodgy plugins, Yes, Output buffering -can- be used, but its expensive to buffer the output and perform string operations on such large text.

Fix the problem, Dont fix the result

comment:14 @cbanack6 years ago

Unfortunately, the WP development team does not have the ability to "fix the problem" for every plugin out there. But they do have the ability to "fix the results", which is what they should do.

A quick search through google or the wordpress forums will reveal that this is not a trivial issue that only a few people are experiencing--it's been an ongoing pain point for users for years. And only a few of them are blaming their plug-ins most people who encounter this issue just just say: wordpress is cool, but its rss feeds don't always work.

I don't have the specific php expertise to evaluate the performance issue that you've mentioned regarding my proposed patch. But I urge the WP dev team to seriously weigh the trade offs involved. Bear in mind that most users won't have the time or ability to track down and solve this problem for themselves as I have.

Surely there's a more effective solution than: "just make everyone else stop writing bad plugins"? That's just not practical.

@Denis-de-Bernardy6 years ago

comment:15 @Denis-de-Bernardy6 years ago

  • Keywords has-patch tested added
  • Milestone set to 2.8

the attached 108.diff removes the unneeded, and potentially buggy spaces in WP.

comment:16 @ryan6 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [10952]) Remove unneeded spaces. Props Denis-de-Bernardy. fixes #108

comment:17 @slackbot3 months ago

This ticket was mentioned in Slack in #forums by ipstenu. View the logs.

comment:18 @slackbot3 months ago

This ticket was mentioned in Slack in #forums by ipstenu. View the logs.

Note: See TracTickets for help on using tickets.