|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull Requests | |||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 12:00:01 2025 UTC | 
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"; }