MDL-51603 dataformats: coding_exception if output buffering

This commit is contained in:
David Monllao 2016-04-21 14:47:09 +08:00
parent 5b95105600
commit 9df4ae4189
4 changed files with 5 additions and 10 deletions

View file

@ -1704,10 +1704,8 @@ class table_dataformat_export_format extends table_default_export_format_parent
public function __construct(&$table, $dataformat) {
parent::__construct($table);
if (!NO_OUTPUT_BUFFERING) {
// Ideally this would throw a coding exception but we are more forgiving here due
// to the large amount of code already using table_sql.
debugging("NO_OUTPUT_BUFFERING should be set to true before downloading", DEBUG_DEVELOPER);
if (ob_get_length()) {
throw new coding_exception("Output can not be buffered before instantiating table_dataformat_export_format");
}
$classname = 'dataformat_' . $dataformat . '\writer';