Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
6a79208143
@ -162,7 +162,7 @@ class PMA_Error extends PMA_Message
|
||||
} catch(Exception $e){
|
||||
$backtrace = '';
|
||||
}
|
||||
if (null === $this->_hash) {
|
||||
if ($this->_hash === null) {
|
||||
$this->_hash = md5(
|
||||
$this->getNumber() .
|
||||
$this->getMessage() .
|
||||
@ -246,45 +246,52 @@ class PMA_Error extends PMA_Message
|
||||
}
|
||||
|
||||
/**
|
||||
* Display HTML backtrace
|
||||
* Get HTML backtrace
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function displayBacktrace()
|
||||
public function getBacktraceDisplay()
|
||||
{
|
||||
$retval = '';
|
||||
|
||||
foreach ($this->getBacktrace() as $step) {
|
||||
echo PMA_Error::relPath($step['file']) . '#' . $step['line'] . ': ';
|
||||
$retval .= PMA_Error::relPath($step['file']) . '#' . $step['line'] . ': ';
|
||||
if (isset($step['class'])) {
|
||||
echo $step['class'] . $step['type'];
|
||||
$retval .= $step['class'] . $step['type'];
|
||||
}
|
||||
echo $step['function'] . '(';
|
||||
$retval .= $step['function'] . '(';
|
||||
if (isset($step['args']) && (count($step['args']) > 1)) {
|
||||
echo "<br />\n";
|
||||
$retval .= "<br />\n";
|
||||
foreach ($step['args'] as $arg) {
|
||||
echo "\t";
|
||||
$this->displayArg($arg, $step['function']);
|
||||
echo ',' . "<br />\n";
|
||||
$retval .= "\t";
|
||||
$retval .= $this->getArg($arg, $step['function']);
|
||||
$retval .= ',' . "<br />\n";
|
||||
}
|
||||
} elseif (isset($step['args']) && (count($step['args']) > 0)) {
|
||||
foreach ($step['args'] as $arg) {
|
||||
$this->displayArg($arg, $step['function']);
|
||||
$retval .= $this->getArg($arg, $step['function']);
|
||||
}
|
||||
}
|
||||
echo ')' . "<br />\n";
|
||||
$retval .= ')' . "<br />\n";
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a single function argument
|
||||
* if $function is one of include/require the $arg is converted te relative path
|
||||
* Get a single function argument
|
||||
*
|
||||
* if $function is one of include/require
|
||||
* the $arg is converted to a relative path
|
||||
*
|
||||
* @param string $arg
|
||||
* @param string $function
|
||||
*
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
protected function displayArg($arg, $function)
|
||||
protected function getArg($arg, $function)
|
||||
{
|
||||
$retval = '';
|
||||
$include_functions = array(
|
||||
'include',
|
||||
'include_once',
|
||||
@ -293,37 +300,40 @@ class PMA_Error extends PMA_Message
|
||||
);
|
||||
|
||||
if (in_array($function, $include_functions)) {
|
||||
echo PMA_Error::relPath($arg);
|
||||
$retval .= PMA_Error::relPath($arg);
|
||||
} elseif (is_scalar($arg)) {
|
||||
echo gettype($arg) . ' ' . htmlspecialchars($arg);
|
||||
$retval .= getType($arg) . ' ' . htmlspecialchars($arg);
|
||||
} else {
|
||||
echo gettype($arg);
|
||||
$retval .= getType($arg);
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the error in HTML
|
||||
* Gets the error as string of HTML
|
||||
*
|
||||
* @return void
|
||||
* return string
|
||||
*/
|
||||
public function display()
|
||||
public function getDisplay()
|
||||
{
|
||||
echo '<div class="' . $this->getLevel() . '">';
|
||||
$retval = '<div class="' . $this->getLevel() . '">';
|
||||
if (! $this->isUserError()) {
|
||||
echo '<strong>' . $this->getType() . '</strong>';
|
||||
echo ' in ' . $this->getFile() . '#' . $this->getLine();
|
||||
echo "<br />\n";
|
||||
$retval .= '<strong>' . $this->getType() . '</strong>';
|
||||
$retval .= ' in ' . $this->getFile() . '#' . $this->getLine();
|
||||
$retval .= "<br />\n";
|
||||
}
|
||||
echo $this->getMessage();
|
||||
$retval .= $this->getMessage();
|
||||
if (! $this->isUserError()) {
|
||||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
echo "<strong>Backtrace</strong><br />\n";
|
||||
echo "<br />\n";
|
||||
echo $this->displayBacktrace();
|
||||
$retval .= "<br />\n";
|
||||
$retval .= "<br />\n";
|
||||
$retval .= "<strong>Backtrace</strong><br />\n";
|
||||
$retval .= "<br />\n";
|
||||
$retval .= $this->getBacktraceDisplay();
|
||||
}
|
||||
echo '</div>';
|
||||
$this->isDisplayed(true);
|
||||
$retval .= '</div>';
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user