Error
class Error extends Message (View source)
a single error
Properties
protected string | $string | The locale string identifier |
from Message |
protected string | $message | The formatted message |
from Message |
protected bool | $isDisplayed | Whether the message was already displayed |
from Message |
protected bool | $useBBCode | Whether to use BB code when displaying. |
from Message |
protected string|null | $hash | Unique id |
from Message |
protected array | $params | holds parameters |
from Message |
protected (string|Message)[] | $addedMessages | holds additional messages |
from Message |
protected string | $file | The file in which the error occurred |
|
protected int | $line | The line in which the error occurred |
|
protected array | $backtrace | Holds the backtrace for this error |
|
protected bool | $hideLocation | Hide location of errors |
Methods
No description
get Message with customized content
get Message for type of affected rows
get Message for type of deleted rows
get Message for type of inserted rows
get Message of type notice with custom content
get Message of type success with custom content
add parameter as raw HTML, usually in conjunction with strings
add a bunch of messages at once
add a bunch of messages at once
add another raw message to be concatenated on displaying
add another raw message to be concatenated on displaying
add another html message to be concatenated on displaying
set all params at once, usually used in conjunction with string
returns unique PhpMyAdmin\Error\Error::$hash, if not exists it will be created
No description
Gets the error as string of HTML
sets and returns whether the message was displayed or not
Returns the message with corresponding image icon
Process backtrace to avoid path disclosures, objects and so on
Toggles location hiding
sets PhpMyAdmin\Error\Error::$_backtrace
sets PhpMyAdmin\Error\Error::$_line
sets PhpMyAdmin\Error\Error::$_file
returns PhpMyAdmin\Error\Error::$_backtrace for first $count frames pass $count = -1 to get full backtrace.
returns PhpMyAdmin\Error\Error::$file
returns PhpMyAdmin\Error\Error::$line
returns type of error
returns title prepared for HTML Title-Tag
returns title for error
Get HTML backtrace
return formatted backtrace field
Formats function call in a backtrace
Get a single function argument
whether this error is a user error
No description
return short relative path to phpMyAdmin basedir
Details
__construct(int $errorNumber, string $errstr, string $errfile, int $errline)
No description
string
__toString()
magic method: return string representation for this object
static Message
success(string $string = '')
get Message of type success
shorthand for getting a simple success message
static Message
error(string $string = '')
get Message of type error
shorthand for getting a simple error message
static Message
notice(string $string)
get Message of type notice
shorthand for getting a simple notice message
static Message
raw(string $message, MessageType $type = MessageType::Notice)
get Message with customized content
shorthand for getting a customized message
static Message
getMessageForAffectedRows(int $rows)
get Message for type of affected rows
shorthand for getting a customized message
static Message
getMessageForDeletedRows(int $rows)
get Message for type of deleted rows
shorthand for getting a customized message
static Message
getMessageForInsertedRows(int $rows)
get Message for type of inserted rows
shorthand for getting a customized message
static Message
rawError(string $message)
get Message of type error with custom content
shorthand for getting a customized error message
static Message
rawNotice(string $message)
get Message of type notice with custom content
shorthand for getting a customized notice message
static Message
rawSuccess(string $message)
get Message of type success with custom content
shorthand for getting a customized success message
bool
isSuccess()
No description
bool
isNotice()
No description
bool
isError()
No description
void
setBBCode(bool $useBBCode)
Set whether we should use BB Code when rendering.
void
setMessage(string $message)
set raw message (overrides string)
void
setString(string $string)
set string (does not take effect if raw message is set)
void
setType(MessageType $type)
No description
void
addParam(mixed $param)
add string or Message parameter
usage
$message->addParam('[em]some string[/em]');
void
addParamHtml(string $param)
add parameter as raw HTML, usually in conjunction with strings
usage
$message->addParamHtml('<img src="img">');
void
addMessages(array $messages, string $separator = ' ')
add a bunch of messages at once
void
addMessagesString(array $messages, string $separator = ' ')
add a bunch of messages at once
void
addMessage(Message $message, string $separator = ' ')
add another raw message to be concatenated on displaying
void
addText(string $message, string $separator = ' ')
add another raw message to be concatenated on displaying
void
addHtml(string $message, string $separator = ' ')
add another html message to be concatenated on displaying
void
setParams(array $params)
set all params at once, usually used in conjunction with string
array
getParams()
return all parameters
array
getAddedMessages()
return all added messages
string
getHash()
returns unique PhpMyAdmin\Error\Error::$hash, if not exists it will be created
string
getMessage()
returns compiled message
string
getOnlyMessage()
Returns only message string without image & other HTML.
string
getString()
returns Message::$string
protected MessageType
getLevel()
No description
string
getContext()
No description
string
getDisplay()
Gets the error as string of HTML
bool
isDisplayed(bool $isDisplayed = false)
sets and returns whether the message was displayed or not
string
getMessageWithIcon(string $message)
Returns the message with corresponding image icon
static array
processBacktrace(array $backtrace)
Process backtrace to avoid path disclosures, objects and so on
void
setHideLocation(bool $hide)
Toggles location hiding
void
setBacktrace(array $backtrace)
sets PhpMyAdmin\Error\Error::$_backtrace
We don't store full arguments to avoid wakeup or memory problems.
void
setLine(int $line)
sets PhpMyAdmin\Error\Error::$_line
void
setFile(string $file)
sets PhpMyAdmin\Error\Error::$_file
array
getBacktrace(int $count = -1)
returns PhpMyAdmin\Error\Error::$_backtrace for first $count frames pass $count = -1 to get full backtrace.
The same can be done by not passing $count at all.
string
getFile()
returns PhpMyAdmin\Error\Error::$file
int
getLine()
returns PhpMyAdmin\Error\Error::$line
string
getType()
returns type of error
string
getHtmlTitle()
returns title prepared for HTML Title-Tag
string
getTitle()
returns title for error
string
getBacktraceDisplay()
Get HTML backtrace
static string
formatBacktrace(array $backtrace)
return formatted backtrace field
static string
getFunctionCall(array $step)
Formats function call in a backtrace
static string
getArg(mixed $arg, string $function)
Get a single function argument
if $function is one of include/require the $arg is converted to a relative path
bool
isUserError()
whether this error is a user error
int
getErrorNumber()
No description
static string
relPath(string $path)
return short relative path to phpMyAdmin basedir
prevent path disclosure in error message, and make users feel safe to submit error reports