CVS update: /cowiki/includes/cowiki/class/plugin/

[email protected] 9 Jun 2005 01:41:59 -0000
Newsgroups gmane.comp.php.cowiki.cvs
Message-ID <[email protected]>
User: dgorski 
Date: 2005/06/08 18:41:59

Modified:
   cowiki/includes/cowiki/class/plugin/class.PluginLoader.php

Log:
 Issue #230: If error reporting level is not set to E_ALL, suppress all notices, warnings and/or errors - or vice versa: the error reporting level needs to be set to E_ALL for coWiki to display notices, warnings or errors in browser output.

File Changes:

Directory: /cowiki/includes/cowiki/class/plugin/
================================================

File [changed]: class.PluginLoader.php
Url: http://cowiki.tigris.org/source/browse/cowiki/includes/cowiki/class/plugin/class.PluginLoader.php?r1=1.26&r2=1.27
Delta lines:  +16 -6
--------------------
--- class.PluginLoader.php	11 Mar 2005 18:08:02 -0000	1.26
+++ class.PluginLoader.php	9 Jun 2005 01:41:57 -0000	1.27
@@ -2,7 +2,7 @@
 
 /**
  *
- * $Id: class.PluginLoader.php,v 1.26 2005/03/11 18:08:02 dgorski Exp $
+ * $Id: class.PluginLoader.php,v 1.27 2005/06/09 01:41:57 dgorski Exp $
  *
  * This file is part of coWiki. coWiki is free software under the terms of
  * the GNU General Public License (GPL). Read the LICENSE file. If you did
@@ -17,7 +17,7 @@
  * @author      Daniel T. Gorski, <[email protected]>
  * @copyright   (C) Daniel T. Gorski, {@link http://www.develnet.org}
  * @license     http://www.gnu.org/licenses/gpl.html
- * @version     $Revision: 1.26 $
+ * @version     $Revision: 1.27 $
  *
  */
 
@@ -285,14 +285,24 @@
      * @todo    [D11N]  Check return type
      */
     public function instantiate($sName) {
-        $Obj = false;
+        $Obj = null;
 
         $sName = strtolower($sName);
 
-        if (isset($this->aPluginMap[$sName])
-            && @include_once($this->aPluginMap[$sName])) {
+        // Include plugin. Suppress notices, warning and errors if error
+        // reporting level is not explicitly set to E_ALL.
+        if (isset($this->aPluginMap[$sName])) {
 
+            if ((ini_get('error_reporting') & E_ALL) == 0) {
+                if (@include_once($this->aPluginMap[$sName])) {
             $Obj = new $sName;
+                }
+
+            } else {
+                if (include_once($this->aPluginMap[$sName])) {
+                    $Obj = new $sName;
+                }
+            }
         }
 
         return $Obj;