WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have PHP errors redirected to log file. Only for WP installation so this definitely doesn't come from somewhere else. This is what started to come up recently (this is all of them, not cut):

[22-Sep-2010 14:30:41] junk after document element at line 2, column 0
[22-Sep-2010 16:17:08] junk after document element at line 2, column 0
[22-Sep-2010 17:19:42] junk after document element at line 2, column 0
[22-Sep-2010 18:30:19] junk after document element at line 2, column 0
[22-Sep-2010 20:19:23] junk after document element at line 2, column 0
[23-Sep-2010 14:51:40] junk after document element at line 2, column 0
[23-Sep-2010 15:54:33] junk after document element at line 2, column 0
[23-Sep-2010 17:23:02] junk after document element at line 2, column 0

This doesn't really look like PHP error (function blah-blah failed at line x), they are very infrequent and don't seem to be tied to page loads (maybe to some cron event?) and there hadn't been any major configuration changes in months other than keeping plugins up to date and one or two new ones (days before this started).

Googling results are mostly about XML parsing... Of which WP probably does plenty (feeds, updates, what else?..) but how to pinpoint what is going wrong?

This has me really puzzled.

share|improve this question
up vote 1 down vote accepted

A quick Google search confirmed your suspicion ... this is likely an XML parsing error. Furthermore, some discussion on the forums suggests it's caused by script insertion after a closing </rss> tag.

If it is an inserted script, this is likely the result of a hack or an attack on your site or host.

Another possibility is a PHP error in the RSS-generation script. PHP would return the error in-line, and the error message, being non-XML, would be read as "junk" by the XML parser. This could also be the result of a feed your site is trying to read (i.e. on the admin dashboard), not necessarily a feed you're generating.

share|improve this answer
I saw topics, but they'd apply if my pages where causing error at external parser... Situation seems opposite - something causing it at my parser. For the record there are no signs of a hack, triple-checking that was my first move as soon as word "hack" came up in Google. I am trying to check external feeds, but there is bunch of them (RSS junkie here..) – Rarst Sep 23 '10 at 18:12
but there is bunch of them ... and if any one of them was hacked on the external site, it would through this kind of error on your end. It won't cause a vulnerability for your site, but the XML parser will still choke on the "junk." – EAMann Sep 23 '10 at 18:24

Solved. External feed idea was correct, figuring out feed was slightly more complex.

I had installed Core Control plugin and enabled log of HTTP requests.

Then it was just sitting and waiting until error re-occurs and checking which feed was downloaded at exactly same time.

Subject feed:

  • belonged to one of recently installed plugins;
  • was fried dead with PHP fatal error instead of content.

And feed validator was giving exact match on it:

line 1, column 0: Undefined root element: br

line 2, column 0: XML parsing error: :2:0: junk after document element

PS I am not sure which answer better to accept, this with exact solution or EAMann's with ideas and discussion? Edit: can't accept my own for two days anyway, that one it is.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.