php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #77525 Some fatal errors should be `CompileError`s
Submitted: 2019-01-26 10:13 UTC Modified: -
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: qwertyasdfg99 at gmail dot com Assigned:
Status: Open Package: Scripting Engine problem
PHP Version: 7.3.1 OS: Fedora 27
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: qwertyasdfg99 at gmail dot com
New email:
PHP Version: OS:

 

 [2019-01-26 10:13 UTC] qwertyasdfg99 at gmail dot com
Description:
------------
The test script below reads a line of PHP code, evaluates it, and
prints its return value or catches and prints any exception that may
be thrown.  However, if the user of the script enters a line like:

    function ($x = time()) {}

or
    time() = 1

a fatal error is triggered and the script ends.

Those errors should be `CompileError`s instead of fatal errors.  That
would make it possible for the script to catch those errors, print
them and continue running.

In `Zend/zend_compile.c` there are other instances of similar errors
(fatal errors that should be `CompileError`s).

Test script:
---------------
while (($line = readline("> ")) !== FALSE) {
    try {
        var_export(eval("return $line;"));
    } catch (Throwable $exception) {
        echo $exception;
    }
    echo "\n";
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 20:01:26 2019 UTC