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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 14 14:01:27 2024 UTC