PHP 7.2.8 Released

Error

(PHP 7)

Введение

Error - базовый класс для всех внутренних ошибок PHP.

Обзор классов

Error implements Throwable {
/* Свойства */
protected string $message ;
protected int $code ;
protected string $file ;
protected int $line ;
/* Методы */
public __construct ([ string $message = "" [, int $code = 0 [, Throwable $previous = NULL ]]] )
final public string getMessage ( void )
final public Throwable getPrevious ( void )
final public mixed getCode ( void )
final public string getFile ( void )
final public int getLine ( void )
final public array getTrace ( void )
final public string getTraceAsString ( void )
public string __toString ( void )
final private void __clone ( void )
}

Свойства

message

Сообщение об ошибке

code

Код ошибки

file

Имя файла, в котором произошла ошибка

line

Номер строки, в которой произошла ошибка

Содержание

add a note add a note

User Contributed Notes 3 notes

up
8
JustinasMalkas
2 years ago
If after PHP upgrade you're getting error "PHP Fatal error:  Cannot declare class error, because the name is already in use ...", you will have to rename your "error" class.
Since PHP 7 classname "Error" is predefined and used internally.
up
0
whysteepy at gmail dot com
5 months ago
Lists of Throwable and Exception tree as of 7.2.0

    Error
      ArithmeticError
        DivisionByZeroError
      AssertionError
      ParseError
      TypeError
        ArgumentCountError
    Exception
      ClosedGeneratorException
      DOMException
      ErrorException
      IntlException
      LogicException
        BadFunctionCallException
          BadMethodCallException
        DomainException
        InvalidArgumentException
        LengthException
        OutOfRangeException
      PharException
      ReflectionException
      RuntimeException
        OutOfBoundsException
        OverflowException
        PDOException
        RangeException
        UnderflowException
        UnexpectedValueException
      SodiumException

Find the script and output in the following links:
https://gist.github.com/mlocati/249f07b074a0de339d4d1ca980848e6a
https://3v4l.org/sDMsv

posted here http://php.net/manual/en/class.throwable.php
up
0
Anonymous
11 months ago
And a static class called "error" when is trigged is renamed "Error" since PHP 7
To Top