';
} else {
$retval .= getType($arg);
}
return $retval;
}
/**
* Gets the error as string of HTML
*
* @return string
*/
public function getDisplay()
{
$this->isDisplayed(true);
$retval = '';
if (! $this->isUserError()) {
$retval .= '' . $this->getType() . '';
$retval .= ' in ' . $this->getFile() . '#' . $this->getLine();
$retval .= "
\n";
}
$retval .= $this->getMessage();
if (! $this->isUserError()) {
$retval .= "
\n";
$retval .= "
\n";
$retval .= "Backtrace
\n";
$retval .= "
\n";
$retval .= $this->getBacktraceDisplay();
}
$retval .= '
';
return $retval;
}
/**
* whether this error is a user error
*
* @return boolean
*/
public function isUserError()
{
return $this->hide_location ||
($this->getNumber() & (E_USER_WARNING | E_USER_ERROR | E_USER_NOTICE | E_USER_DEPRECATED));
}
/**
* return short relative path to phpMyAdmin basedir
*
* prevent path disclosure in error message,
* and make users feel safe to submit error reports
*
* @param string $path path to be shorten
*
* @return string shortened path
*/
public static function relPath($path)
{
$dest = @realpath($path);
/* Probably affected by open_basedir */
if ($dest === false) {
return basename($path);
}
$Ahere = explode(
DIRECTORY_SEPARATOR,
realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..')
);
$Adest = explode(DIRECTORY_SEPARATOR, $dest);
$result = '.';
// && count ($Adest)>0 && count($Ahere)>0 )
while (implode(DIRECTORY_SEPARATOR, $Adest) != implode(DIRECTORY_SEPARATOR, $Ahere)) {
if (count($Ahere) > count($Adest)) {
array_pop($Ahere);
$result .= DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..';
} else {
array_pop($Adest);
}
}
$path = $result . str_replace(implode(DIRECTORY_SEPARATOR, $Adest), '', $dest);
return str_replace(
DIRECTORY_SEPARATOR . PATH_SEPARATOR,
DIRECTORY_SEPARATOR,
$path
);
}
}