use wcf\system\cronjob\CronjobScheduler;
use wcf\system\event\EventHandler;
use wcf\system\exception\AJAXException;
+use wcf\system\exception\ErrorException;
use wcf\system\exception\IPrintableException;
use wcf\system\exception\NamedUserException;
use wcf\system\exception\PermissionDeniedException;
}
/**
- * Catches php errors and throws instead a system exception.
+ * Turns PHP errors into an ErrorException.
*
* @param integer $errorNo
* @param string $message
* @param string $filename
* @param integer $lineNo
*/
- public static final function handleError($errorNo, $message, $filename, $lineNo) {
- if (error_reporting() != 0) {
- $type = 'error';
- switch ($errorNo) {
- case 2: $type = 'warning';
- break;
- case 8: $type = 'notice';
- break;
- }
-
- throw new SystemException('PHP '.$type.' in file '.$filename.' ('.$lineNo.'): '.$message, 0);
- }
+ public static final function handleError($severity, $message, $file, $line) {
+ // this is neccessary for the shut-up operator
+ if (error_reporting() == 0) return;
+
+ throw new ErrorException($message, 0, $severity, $file, $line);
}
/**
--- /dev/null
+<?php
+namespace wcf\system\exception;
+
+/**
+ * This is a custom implementation of the default \ErrorException.
+ * It is used for backwards compatibility reasons. Do not rely on it
+ * inheriting \wcf\system\exception\SystemException.
+ *
+ * @author Tim Duesterhus
+ * @copyright 2001-2015 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.exception
+ * @category Community Framework
+ */
+class ErrorException extends SystemException {
+ /**
+ * @see \ErrorException::$severity
+ */
+ protected $severity;
+
+ /**
+ * @see \ErrorException::__construct()
+ */
+ public function __construct($message = "", $code = 0, $severity = 1, $filename = __FILE__, $lineno = __LINE__, $previous = null) {
+ parent::__construct($message, $code, "", $previous);
+
+ $this->severity = $severity;
+ }
+
+ /**
+ * @see \ErrorException::getSeverity()
+ */
+ public function getSeverity() {
+ return $this->severity;
+ }
+}