How to handle core code throwing notice on valid input?

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.

Read More

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?

Related posts

Leave a Reply

2 comments

  1. 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. 🙂

  2. 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.