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?
Simply use the
@
operator in front of a function to suppress an error message/notice/whatever. Fun as it is: Even theimage_resize()
function uses it forchmod
. 🙂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
isfalse
, ignore the errors. If it istrue
, 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.