Steps to replicate the issue (include links if applicable):
- Create an extension with a parser function.
- Set the return value for the parser function to [] (or anything without a text or 0-indexed parameter)
- Use the new function on a page.
What happens?:
No error is generated immediately; instead, braceSubstitution() starts popping up Undefined index: text notices with no indication as to the actual cause of the problem.
What should have happened instead?:
Either the situation should have been handled gracefully, in a similar fashion to handling an empty string, or an error message should have been generated at the site of the actual problem.
Other information (browser name/version, screenshots, etc.):
If graceful handling is preferred, I believe replacing the code towards the end of callParserFunction() with the following should do the trick:
if (!is_array($result)) { ... } else { if (!isset($result['text'])) { if (isset($result[0])) { $result['text'] = $result[0]; unset($result[0]); } else { $result['text'] = ''; } } ... }