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 combination of valid input with native WP function throwing PHP notice. In this specific case it is image without extension with image_resize().

This is usually suppressed by WP, but it still has me worried because it runs in feed and such things can explode XML to pieces.

If I can neither change core or input then what should I do? I suppose I could try to explicitly suppress error output around there.

Or should I just ignore the possibility as edge case?

share|improve this question
Where exactly did you get an error and what does it say? It is a php notice or a wordpress error from the wp_error class? – kaiser May 25 '11 at 10:50
@kaiser as described - it's PHP notice, because image_resize() expects image to always have extension when it parses path. – Rarst May 25 '11 at 11:03
up vote 2 down vote accepted

Simply use the @ operator in front of a function to suppress an error message/notice/whatever. Fun as it is: Even the image_resize() function uses it for chmod. :)

share|improve this answer

You can set up your own error handler, that either ignores the errors or outputs them in comments in the feed. Let it depend on the "surrounding" configuration, so if WP_DEBUG is false, ignore the errors. If it is true, output them in XML comments at the end of the feed, so you don't start a comment when you are in the middle of a tag.

If notices are displayed this is probably because the administrator explicitly enabled them. You would not do this on a production site, so it should be expected that some output (like RSS feeds) can break.

share|improve this answer
Great idea, that I will explore some time, but accepting kaiser's answer as more practical and immediate solution to my specific issue. – Rarst May 28 '11 at 19:42

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.