php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15911 call to undefined function in eval ()'ed code causes script to die
Submitted: 2002-03-06 14:06 UTC Modified: 2002-09-09 10:23 UTC
From: sander@php.net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.0CVS-2002-03-06 OS: Debian (Sid) Linux
Private report: No CVE-ID: None
 [2002-03-06 14:06 UTC] sander@php.net
If eval()'ed code contains a parse error, the rest of the php script will continue. If it contains a call to an undefined function, it will die, and it won't execute the rest of the script.
That's very inconsistant behaviour!!!!

<?php
eval("foo();");
echo "bar"; // this will never be executed!!!
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-09 10:23 UTC] stas@php.net
Yes, this is indeed the case and this is intended behaviour. For now there is no a good way to recover from undefined funxtion error inside running script, so indeed it causes a fatal error. If you have good reasons why it should be changed, etc., you could submit feature request and/or contact developers on php-dev@lists.php.net. 
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 28 17:00:02 2025 UTC