|  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: -
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: qwertyasdfg99 at gmail dot com
New email:
PHP Version: OS:


 [2019-01-26 10:13 UTC] qwertyasdfg99 at gmail dot com
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()) {}

    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";


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 17 18:01:28 2024 UTC