class Error extends Message (View source)

a single error

Constants

SUCCESS

NOTICE

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

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

No description

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 = self::NOTICE)

get Message with customized content

from  Message
static Message
getMessageForAffectedRows(int $rows)

get Message for type of affected rows

from  Message
static Message
getMessageForDeletedRows(int $rows)

get Message for type of deleted rows

from  Message
static Message
getMessageForInsertedRows(int $rows)

get Message for type 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()

No description

from  Message
bool
isNotice()

No description

from  Message
bool
isError()

No description

from  Message
void
setBBCode(bool $useBBCode)

Set whether we should use BB Code when rendering.

from  Message
void
setMessage(string $message)

set raw message (overrides string)

from  Message
void
setString(string $string)

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

from  Message
void
setType(int $type)

set message type type

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 $params)

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

from  Message
array
getParams()

return all parameters

from  Message
array
getAddedMessages()

return all added messages

from  Message
string
getHash()

returns unique PhpMyAdmin\Error\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
string
getLevel()

returns level of error

string
getContext()

No description

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 disclosures, objects and so on

void
setHideLocation(bool $hide)

Toggles location hiding

void
setBacktrace(array $backtrace)

sets PhpMyAdmin\Error\Error::$_backtrace

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.

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

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

Details

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

No description

Parameters

int $errorNumber
string $errstr

error message

string $errfile file
int $errline line

string __toString()

magic method: return string representation for this object

Return Value

string

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

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

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

static Message raw(string $message, int $type = self::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

static Message getMessageForAffectedRows(int $rows)

get Message for type of affected rows

shorthand for getting a customized message

Parameters

int $rows

Number of rows

Return Value

Message

static Message getMessageForDeletedRows(int $rows)

get Message for type of deleted rows

shorthand for getting a customized message

Parameters

int $rows

Number of rows

Return Value

Message

static Message getMessageForInsertedRows(int $rows)

get Message for type of inserted rows

shorthand for getting a customized message

Parameters

int $rows

Number of rows

Return Value

Message

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

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

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

bool isSuccess()

No description

Return Value

bool

bool isNotice()

No description

Return Value

bool

bool isError()

No description

Return Value

bool

void setBBCode(bool $useBBCode)

Set whether we should use BB Code when rendering.

Parameters

bool $useBBCode

Use BB Code?

Return Value

void

void setMessage(string $message)

set raw message (overrides string)

Parameters

string $message

A localized string

Return Value

void

void setString(string $string)

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

Parameters

string $string

string to set

Return Value

void

void setType(int $type)

set message type type

Parameters

int $type

message type type to set

Return Value

void

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

void addParamHtml(string $param)

add parameter as raw HTML, usually in conjunction with strings

usage

$message->addParamHtml('<img src="img">');

Parameters

string $param

parameter to add

Return Value

void

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

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

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

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

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

void setParams(array $params)

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

Parameters

array $params

parameters to set

Return Value

void

array getParams()

return all parameters

Return Value

array

array getAddedMessages()

return all added messages

Return Value

array

string getHash()

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

Return Value

string Message::$hash

string getMessage()

returns compiled message

Return Value

string

complete message

string getOnlyMessage()

Returns only message string without image & other HTML.

Return Value

string

string getString()

returns Message::$string

Return Value

string Message::$string

string getLevel()

returns level of error

Return Value

string

level of message

string getContext()

No description

Return Value

string

string getDisplay()

Gets the error as string of HTML

Return Value

string

whole message box

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

string getMessageWithIcon(string $message)

Returns the message with corresponding image icon

Parameters

string $message

the message(s)

Return Value

string

message with icon

static array processBacktrace(array $backtrace)

Process backtrace to avoid path disclosures, objects and so on

Parameters

array $backtrace backtrace

Return Value

array

void setHideLocation(bool $hide)

Toggles location hiding

Parameters

bool $hide

Whether to hide

Return Value

void

void setBacktrace(array $backtrace)

sets PhpMyAdmin\Error\Error::$_backtrace

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

Parameters

array $backtrace backtrace

Return Value

void

void setLine(int $line)

sets PhpMyAdmin\Error\Error::$_line

Parameters

int $line

the line

Return Value

void

void setFile(string $file)

sets PhpMyAdmin\Error\Error::$_file

Parameters

string $file

the file

Return Value

void

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.

Parameters

int $count

Number of stack frames.

Return Value

array PhpMyAdmin\Error\Error::$_backtrace

string getFile()

returns PhpMyAdmin\Error\Error::$file

Return Value

string PhpMyAdmin\Error\Error::$file

int getLine()

returns PhpMyAdmin\Error\Error::$line

Return Value

int PhpMyAdmin\Error\Error::$line

string getType()

returns type of error

Return Value

string

type of error

string getHtmlTitle()

returns title prepared for HTML Title-Tag

Return Value

string

HTML escaped and truncated title

string getTitle()

returns title for error

Return Value

string

string getBacktraceDisplay()

Get HTML backtrace

Return Value

string

static string formatBacktrace(array $backtrace)

return formatted backtrace field

Parameters

array $backtrace

Backtrace data

Return Value

string

formatted backtrace

static string getFunctionCall(array $step)

Formats function call in a backtrace

Parameters

array $step

backtrace step

Return Value

string

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

Parameters

mixed $arg

argument to process

string $function

function name

Return Value

string

bool isUserError()

whether this error is a user error

Return Value

bool

int getErrorNumber()

No description

Return Value

int

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