From: Roan Kattouw Date: Wed, 26 Mar 2008 14:01:28 +0000 (+0000) Subject: API: Don't output error messages caused by display_errors=On when using a non-fm... X-Git-Tag: 1.31.0-rc.0~48798 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=2d69c8b982ece149b749561df7fb14bfd788e4db;p=lhc%2Fweb%2Fwiklou.git API: Don't output error messages caused by display_errors=On when using a non-fm format --- diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index 6863193990..b6b6c5ce94 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -35,7 +35,7 @@ if (!defined('MEDIAWIKI')) { */ abstract class ApiFormatBase extends ApiBase { - private $mIsHtml, $mFormat, $mUnescapeAmps, $mHelp; + private $mIsHtml, $mFormat, $mUnescapeAmps, $mHelp, $mCleared; /** * Create a new instance of the formatter. @@ -50,6 +50,7 @@ abstract class ApiFormatBase extends ApiBase { else $this->mFormat = $format; $this->mFormat = strtoupper($this->mFormat); + $this->mCleared = false; } /** @@ -166,7 +167,17 @@ See complete documentation, or if ($this->getIsHtml()) echo $this->formatHTML($text); else + { + // For non-HTML output, clear all errors that might have been + // displayed if display_errors=On + // Do this only once, of course + if(!$this->mCleared) + { + ob_clean(); + $this->mCleared = true; + } echo $text; + } } /**