class Error extends Message

a single error

Constants

SUCCESS

NOTICE

ERROR

SANITIZE_NONE

SANITIZE_STRING

SANITIZE_PARAMS

SANITIZE_BOOTH

Properties

static array $level message levels from Message
protected integer $number The message number from Message
protected string $string The locale string identifier from Message
protected string $message The formatted message from Message
protected boolean $isDisplayed Whether the message was already displayed from Message
protected boolean $useBBCode Whether to use BB code when displaying. from Message
protected string $hash Unique id from Message
protected array $params holds parameters from Message
protected array $addedMessages holds additional messages from Message
static array $errortype Error types
static array $errorlevel Error levels
protected string $file The file in which the error occurred
protected integer $line The line in which the error occurred
protected array $backtrace Holds the backtrace for this error
protected $hide_location Hide location of errors

Methods

__construct(int $errno, string $errstr, string $errfile, int $errline)

Constructor

string
__toString()

magic method: return string representation for this object

from Message
static Message
success(string $string = '')

get Message of type success

from Message
static Message
error(string $string = '')

get Message of type error

from Message
static Message
notice(string $string)

get Message of type notice

from Message
static Message
raw(string $message, int $type = Message::NOTICE)

get Message with customized content

from Message
static Message
getMessageForAffectedRows(int $rows)

get Message for number of affected rows

from Message
static Message
getMessageForDeletedRows(int $rows)

get Message for number of deleted rows

from Message
static Message
getMessageForInsertedRows(int $rows)

get Message for number of inserted rows

from Message
static Message
rawError(string $message)

get Message of type error with custom content

from Message
static Message
rawNotice(string $message)

get Message of type notice with custom content

from Message
static Message
rawSuccess(string $message)

get Message of type success with custom content

from Message
bool
isSuccess(bool $set = false)

returns whether this message is a success message or not and optionally makes this message a success message

from Message
bool
isNotice(bool $set = false)

returns whether this message is a notice message or not and optionally makes this message a notice message

from Message
bool
isError(bool $set = false)

returns whether this message is an error message or not and optionally makes this message an error message

from Message
void
setBBCode(bool $useBBCode)

Set whether we should use BB Code when rendering.

from Message
void
setMessage(string $message, bool $sanitize = false)

set raw message (overrides string)

from Message
void
setString(string $string, boolean|int $sanitize = true)

set string (does not take effect if raw message is set)

from Message
void
setNumber(int $number)

set message type number

from Message
void
addParam(mixed $param)

add string or Message parameter

from Message
void
addParamHtml(string $param)

add parameter as raw HTML, usually in conjunction with strings

from Message
void
addMessages(array $messages, string $separator = ' ')

add a bunch of messages at once

from Message
void
addMessagesString(array $messages, string $separator = ' ')

add a bunch of messages at once

from Message
void
addMessage(Message $message, string $separator = ' ')

add another raw message to be concatenated on displaying

from Message
void
addText(string $message, string $separator = ' ')

add another raw message to be concatenated on displaying

from Message
void
addHtml(string $message, string $separator = ' ')

add another html message to be concatenated on displaying

from Message
void
setParams(array|string $params, bool|int $sanitize = false)

set all params at once, usually used in conjunction with string

from Message
array|string
getParams()

return all parameters

from Message
array
getAddedMessages()

return all added messages

from Message
static mixed
sanitize(mixed $message)

Sanitizes $message

from Message
static string
decodeBB(string $message)

decode $message, taking into account our special codes for formatting

from Message
static string
format(mixed[] ...$params)

wrapper for sprintf()

from Message
string
getHash()

returns unique PhpMyAdmin\Error::$hash, if not exists it will be created

string
getMessage()

returns compiled message

from Message
string
getOnlyMessage()

Returns only message string without image & other HTML.

from Message
string
getString()

returns Message::$string

from Message
int
getNumber()

returns Message::$number

from Message
string
getLevel()

returns level of error

void
display()

Displays the message in HTML

from Message
string
getDisplay()

Gets the error as string of HTML

bool
isDisplayed(bool $isDisplayed = false)

sets and returns whether the message was displayed or not

from Message
string
getMessageWithIcon(string $message)

Returns the message with corresponding image icon

from Message
static array
processBacktrace(array $backtrace)

Process backtrace to avoid path disclossures, objects and so on

void
setHideLocation(bool $hide)

Toggles location hiding

void
setBacktrace(array $backtrace)

sets PhpMyAdmin\Error::$_backtrace

void
setLine(int $line)

sets PhpMyAdmin\Error::$_line

void
setFile(string $file)

sets PhpMyAdmin\Error::$_file

array
getBacktrace(int $count = -1)

returns PhpMyAdmin\Error::$_backtrace for first $count frames pass $count = -1 to get full backtrace.

string
getFile()

returns PhpMyAdmin\Error::$file

int
getLine()

returns PhpMyAdmin\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, string $separator, string $lines)

return formatted backtrace field

static string
getFunctionCall(array $step, string $separator)

Formats function call in a backtrace

static string
getArg(string $arg, string $function)

Get a single function argument

bool
isUserError()

whether this error is a user error

static string
relPath(string $path)

return short relative path to phpMyAdmin basedir

Details

at line 101
__construct(int $errno, string $errstr, string $errfile, int $errline)

Constructor

Parameters

int $errno error number
string $errstr error message
string $errfile file
int $errline line

in Message at line 156
string __toString()

magic method: return string representation for this object

Return Value

string

in Message at line 173
static Message success(string $string = '')

get Message of type success

shorthand for getting a simple success message

Parameters

string $string A localized string e.g. __('Your SQL query has been executed successfully')

Return Value

Message

in Message at line 192
static Message error(string $string = '')

get Message of type error

shorthand for getting a simple error message

Parameters

string $string A localized string e.g. __('Error')

Return Value

Message

in Message at line 214
static Message notice(string $string)

get Message of type notice

shorthand for getting a simple notice message

Parameters

string $string A localized string e.g. __('The additional features for working with linked tables have been deactivated. To find out why click %shere%s.')

Return Value

Message

in Message at line 230
static Message raw(string $message, int $type = Message::NOTICE)

get Message with customized content

shorthand for getting a customized message

Parameters

string $message A localized string
int $type A numeric representation of the type of message

Return Value

Message

in Message at line 248
static Message getMessageForAffectedRows(int $rows)

get Message for number of affected rows

shorthand for getting a customized message

Parameters

int $rows Number of rows

Return Value

Message

in Message at line 267
static Message getMessageForDeletedRows(int $rows)

get Message for number of deleted rows

shorthand for getting a customized message

Parameters

int $rows Number of rows

Return Value

Message

in Message at line 286
static Message getMessageForInsertedRows(int $rows)

get Message for number of inserted rows

shorthand for getting a customized message

Parameters

int $rows Number of rows

Return Value

Message

in Message at line 305
static Message rawError(string $message)

get Message of type error with custom content

shorthand for getting a customized error message

Parameters

string $message A localized string

Return Value

Message

in Message at line 320
static Message rawNotice(string $message)

get Message of type notice with custom content

shorthand for getting a customized notice message

Parameters

string $message A localized string

Return Value

Message

in Message at line 335
static Message rawSuccess(string $message)

get Message of type success with custom content

shorthand for getting a customized success message

Parameters

string $message A localized string

Return Value

Message

in Message at line 348
bool isSuccess(bool $set = false)

returns whether this message is a success message or not and optionally makes this message a success message

Parameters

bool $set Whether to make this message of SUCCESS type

Return Value

bool whether this is a success message or not

in Message at line 365
bool isNotice(bool $set = false)

returns whether this message is a notice message or not and optionally makes this message a notice message

Parameters

bool $set Whether to make this message of NOTICE type

Return Value

bool whether this is a notice message or not

in Message at line 382
bool isError(bool $set = false)

returns whether this message is an error message or not and optionally makes this message an error message

Parameters

bool $set Whether to make this message of ERROR type

Return Value

bool Whether this is an error message or not

in Message at line 398
void setBBCode(bool $useBBCode)

Set whether we should use BB Code when rendering.

Parameters

bool $useBBCode Use BB Code?

Return Value

void

in Message at line 411
void setMessage(string $message, bool $sanitize = false)

set raw message (overrides string)

Parameters

string $message A localized string
bool $sanitize Whether to sanitize $message or not

Return Value

void

in Message at line 427
void setString(string $string, boolean|int $sanitize = true)

set string (does not take effect if raw message is set)

Parameters

string $string string to set
boolean|int $sanitize whether to sanitize $string or not

Return Value

void

in Message at line 442
void setNumber(int $number)

set message type number

Parameters

int $number message type number to set

Return Value

void

in Message at line 459
void addParam(mixed $param)

add string or Message parameter

usage $message->addParam('[em]some string[/em]');

Parameters

mixed $param parameter to add

Return Value

void

in Message at line 480
void addParamHtml(string $param)

add parameter as raw HTML, usually in conjunction with strings

usage $message->addParamHtml('');

Parameters

string $param parameter to add

Return Value

void

in Message at line 493
void addMessages(array $messages, string $separator = ' ')

add a bunch of messages at once

Parameters

array $messages to be added
string $separator to use between this and previous string/message

Return Value

void

in Message at line 508
void addMessagesString(array $messages, string $separator = ' ')

add a bunch of messages at once

Parameters

array $messages to be added
string $separator to use between this and previous string/message

Return Value

void

in Message at line 539
void addMessage(Message $message, string $separator = ' ')

add another raw message to be concatenated on displaying

Parameters

Message $message to be added
string $separator to use between this and previous string/message

Return Value

void

in Message at line 552
void addText(string $message, string $separator = ' ')

add another raw message to be concatenated on displaying

Parameters

string $message to be added
string $separator to use between this and previous string/message

Return Value

void

in Message at line 565
void addHtml(string $message, string $separator = ' ')

add another html message to be concatenated on displaying

Parameters

string $message to be added
string $separator to use between this and previous string/message

Return Value

void

in Message at line 578
void setParams(array|string $params, bool|int $sanitize = false)

set all params at once, usually used in conjunction with string

Parameters

array|string $params parameters to set
bool|int $sanitize whether to sanitize params

Return Value

void

in Message at line 591
array|string getParams()

return all parameters

Return Value

array|string

in Message at line 601
array getAddedMessages()

return all added messages

Return Value

array

in Message at line 615
static mixed sanitize(mixed $message)

Sanitizes $message

Parameters

mixed $message the message(s)

Return Value

mixed the sanitized message(s)

in Message at line 638
static string decodeBB(string $message)

decode $message, taking into account our special codes for formatting

Parameters

string $message the message

Return Value

string the decoded message

in Message at line 649
static string format(mixed[] ...$params)

wrapper for sprintf()

Parameters

mixed[] ...$params Params

Return Value

string formatted

at line 223
string getHash()

returns unique PhpMyAdmin\Error::$hash, if not exists it will be created

Return Value

string Message::$hash

in Message at line 682
string getMessage()

returns compiled message

Return Value

string complete message

in Message at line 718
string getOnlyMessage()

Returns only message string without image & other HTML.

Return Value

string

in Message at line 729
string getString()

returns Message::$string

Return Value

string Message::$string

in Message at line 739
int getNumber()

returns Message::$number

Return Value

int Message::$number

at line 295
string getLevel()

returns level of error

Return Value

string level of message

in Message at line 759
void display()

Displays the message in HTML

Return Value

void

at line 448
string getDisplay()

Gets the error as string of HTML

Return Value

string whole message box

in Message at line 783
bool isDisplayed(bool $isDisplayed = false)

sets and returns whether the message was displayed or not

Parameters

bool $isDisplayed whether to set displayed flag

Return Value

bool Message::$isDisplayed

in Message at line 799
string getMessageWithIcon(string $message)

Returns the message with corresponding image icon

Parameters

string $message the message(s)

Return Value

string message with icon

at line 129
static array processBacktrace(array $backtrace)

Process backtrace to avoid path disclossures, objects and so on

Parameters

array $backtrace backtrace

Return Value

array

at line 174
void setHideLocation(bool $hide)

Toggles location hiding

Parameters

bool $hide Whether to hide

Return Value

void

at line 188
void setBacktrace(array $backtrace)

sets PhpMyAdmin\Error::$_backtrace

We don't store full arguments to avoid wakeup or memory problems.

Parameters

array $backtrace backtrace

Return Value

void

at line 200
void setLine(int $line)

sets PhpMyAdmin\Error::$_line

Parameters

int $line the line

Return Value

void

at line 212
void setFile(string $file)

sets PhpMyAdmin\Error::$_file

Parameters

string $file the file

Return Value

void

at line 252
array getBacktrace(int $count = -1)

returns PhpMyAdmin\Error::$_backtrace for first $count frames pass $count = -1 to get full backtrace.

The same can be done by not passing $count at all.

Parameters

int $count Number of stack frames.

Return Value

array PhpMyAdmin\Error::$_backtrace

at line 265
string getFile()

returns PhpMyAdmin\Error::$file

Return Value

string PhpMyAdmin\Error::$file

at line 275
int getLine()

returns PhpMyAdmin\Error::$line

Return Value

int PhpMyAdmin\Error::$line

at line 285
string getType()

returns type of error

Return Value

string type of error

at line 305
string getHtmlTitle()

returns title prepared for HTML Title-Tag

Return Value

string HTML escaped and truncated title

at line 317
string getTitle()

returns title for error

Return Value

string

at line 327
string getBacktraceDisplay()

Get HTML backtrace

Return Value

string

at line 345
static string formatBacktrace(array $backtrace, string $separator, string $lines)

return formatted backtrace field

Parameters

array $backtrace Backtrace data
string $separator Arguments separator to use
string $lines Lines separator to use

Return Value

string formatted backtrace

at line 375
static string getFunctionCall(array $step, string $separator)

Formats function call in a backtrace

Parameters

array $step backtrace step
string $separator Arguments separator to use

Return Value

string

at line 407
static string getArg(string $arg, string $function)

Get a single function argument

if $function is one of include/require the $arg is converted to a relative path

Parameters

string $arg argument to process
string $function function name

Return Value

string

at line 475
bool isUserError()

whether this error is a user error

Return Value

bool

at line 491
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

Parameters

string $path path to be shorten

Return Value

string shortened path