Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

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.