ParseError

(PHP 7)

Wstęp

ParseError jest rzucany gdy wystąpi błąd podczas parsowania kodu PHP, na przykład gdy wywoływana jest funkcja eval().

Informacja: Od PHP 7.3.0 ParseError rozszerza CompileError. Wcześniej rozszerzał on Error.

Krótki opis klasy

ParseError extends CompileError {
/* Właściwości dziedziczone */
protected string $message ;
protected int $code ;
protected string $file ;
protected int $line ;
/* Metody dziedziczone */
final public Error::getMessage ( void ) : string
final public Error::getPrevious ( void ) : Throwable
final public Error::getCode ( void ) : mixed
final public Error::getFile ( void ) : string
final public Error::getLine ( void ) : int
final public Error::getTrace ( void ) : array
final public Error::getTraceAsString ( void ) : string
public Error::__toString ( void ) : string
final private Error::__clone ( void ) : void
}
add a note add a note

User Contributed Notes 1 note

up
1
andrian dot test dot job at gmail dot com
4 years ago
<?php
/*
* The function eval() evaluate his argument as an instruction PHP
* Then the argument must respect the standar of PHP codage
* In this example the semicolon are missign
*/

try{

    eval(
"echo 'toto' echo 'tata'");

}catch(
ParseError $p){

    echo
$p->getMessage();
}

/*
* If you run this code the result is different of the result of above code
* PHP will output the standar parse Error: syntax error, ....
*

eval("echo 'toto' echo 'tata'");

*/
To Top