Catch/log E_DEPRECATED errors
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 20 Jan 2010 17:29:29 +0000 (10:29 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 20 Jan 2010 17:29:29 +0000 (10:29 -0700)
framework/Core/lib/Horde.php
horde/lib/core.php

index ef3f8bb..f764f8b 100644 (file)
@@ -264,6 +264,21 @@ HTML;
     }
 
     /**
+     * Log deprecated errors.
+     *
+     * @param integer $errno     See set_error_handler().
+     * @param string $errstr     See set_error_handler().
+     * @param string $errfile    See set_error_handler().
+     * @param integer $errline   See set_error_handler().
+     * @param array $errcontext  See set_error_handler().
+     */
+    static public function logDeprecated($errno, $errstr, $errfile, $errline,
+                                         $errcontext)
+    {
+        self::logMessage($errstr, $errfile, $errline, PEAR_LOG_DEBUG);
+    }
+
+    /**
      * Adds the javascript code to the output (if output has already started)
      * or to the list of script files to include via includeScriptFiles().
      *
index e92c512..c6baf3b 100644 (file)
@@ -48,5 +48,10 @@ include_once 'Log.php';
  * output this unless an admin. */
 set_exception_handler(array('Horde', 'fatal'));
 
+/* Catch and log E_DEPRECATED errors. */
+if (defined('E_DEPRECATED')) {
+    set_error_handler(array('Horde', 'logDeprecated'), E_DEPRECATED);
+}
+
 /* Browser detection object. */
 $browser = Horde_Browser::singleton();