autoscrape.inc: Prevent warnings generated by preg_match_all from breaking JSON output

Issue #53 new
μKöff created an issue

If given an invalid RegExp preg_match_all outputs a warning in the form of

<br />
<b>Warning</b>:  preg_match_all(): Unknown modifier 'b' in <b>/data/project/mix-n-match/autoscrape.inc</b> on line <b>733</b>

which is preprended to the JSON output. Since the JavaScript frontend code is expecting a JSON response this response is interpreted as a failed one and therefore an error is displayed in the user interface. It would be better to either ignore or log this warning by defining a custom error handler using set_error_handler() (example) and maybe adding it in the JSON output.

Comments (1)

  1. Log in to comment