Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authordiosmosis <benakamoorthi@fastmail.fm>2014-08-30 13:01:02 +0400
committerdiosmosis <benakamoorthi@fastmail.fm>2014-08-30 13:01:17 +0400
commit48c8193f770186029ad0120a011fb517364d8e80 (patch)
tree08348e365b1fcd11c2f9bb7f93c45490438da6f0 /core
parentdc48c3132757a6125203368207d71ac1fd32cc0f (diff)
Allow reuse of Error::getErrNoString function.
Diffstat (limited to 'core')
-rw-r--r--core/Error.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/core/Error.php b/core/Error.php
index ac0029d987..7cff6fac0b 100644
--- a/core/Error.php
+++ b/core/Error.php
@@ -76,9 +76,15 @@ class Error
$this->backtrace = $backtrace;
}
- public function getErrNoString()
+ /**
+ * Returns a string description of a PHP error number.
+ *
+ * @param int $errno `E_ERROR`, `E_WARNING`, `E_PARSE`, etc.
+ * @return string
+ */
+ public static function getErrNoString($errno)
{
- switch ($this->errno) {
+ switch ($errno) {
case E_ERROR:
return "Error";
case E_WARNING:
@@ -110,14 +116,14 @@ class Error
case E_USER_DEPRECATED:
return "User Deprecated";
default:
- return "Unknown error ({$this->errno})";
+ return "Unknown error ($errno)";
}
}
public static function formatFileAndDBLogMessage(&$message, $level, $tag, $datetime, $log)
{
if ($message instanceof Error) {
- $message = $message->errfile . '(' . $message->errline . '): ' . $message->getErrNoString()
+ $message = $message->errfile . '(' . $message->errline . '): ' . Error::getErrNoString($message->errno)
. ' - ' . $message->errstr . "\n" . $message->backtrace;
$message = $log->formatMessage($level, $tag, $datetime, $message);
@@ -146,7 +152,7 @@ class Error
<strong>There is an error. Please report the message (Piwik " . (class_exists('Piwik\Version') ? Version::VERSION : '') . ")
and full backtrace in the <a href='?module=Proxy&action=redirect&url=http://forum.piwik.org' target='_blank'>Piwik forums</a> (please do a Search first as it might have been reported already!).<br /><br/>
";
- $htmlString .= $message->getErrNoString();
+ $htmlString .= Error::getErrNoString($message->errno);
$htmlString .= ":</strong> <em>{$message->errstr}</em> in <strong>{$message->errfile}</strong>";
$htmlString .= " on line <strong>{$message->errline}</strong>\n";
$htmlString .= "<br /><br />Backtrace --&gt;<div style=\"font-family:Courier;font-size:10pt\"><br />\n";