Edit report at https://bugs.php.net/bug.php?id=40587&edit=1
ID: 40587 Comment by: matteosistisette at gmail dot com Reported by: mathiasrav at gmail dot com Summary: Attempt to call undefined function gives a fatal error instead of recoverable Status: Bogus Type: Feature/Change Request Package: Feature/Change Request Operating System: WinXP PHP Version: 5.2.1 Block user comment: N Private report: N New Comment: If this is not a bug, this is a HUGE design flaw that MUST be fixed, so is there any difference? If calls to undefined functions were detected at compile time, this would be fine. But since they are detected at runtime, you simply can't debug your code from such errors if a misspelled call happens to be within an if clause. Not being able to catch these errors means not being able to debug them, which means, the language's designed is flawed. A "Fatal error: call to undefined function" SHOULD be a E_RECOVERABLE, not a E_ERROR. Anything that happens at runtime and can conceivably be recovered from, must be a E_RECOVERABLE. Previous Comments: ------------------------------------------------------------------------ [2007-02-21 23:20:50] der...@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php . ------------------------------------------------------------------------ [2007-02-21 23:06:37] mathiasrav at gmail dot com A little change to the description-section - PHP doesn't crash, it simply halts script execution. The *script* "crashes". ------------------------------------------------------------------------ [2007-02-21 23:03:16] mathiasrav at gmail dot com Description: ------------ If you try to call an undefined function, PHP raises an E_ERROR and crashes - not a catchable E_RECOVERABLE_ERROR. This isn't a problem for web-related scripts, but for maintainence/shell-like scripts, this can be a help. I have a script with an idle-loop that calls (includes) module-files, and if a change to one of these has a typo, all socket connections and the like are killed. Reproduce code: --------------- <?php function returntrue(){return true;} seterrorhandler('returntrue', E_RECOVERABLE_ERROR); qweasd(); echo 'Carrying on...'; ?> Expected result: ---------------- The call to qweasd() should return false or null. If the programmer has made the script able to recover from calls to unknown functions, he must have written code that can tell the difference between the return code from a known and an unknown function. Actual result: -------------- The script halts. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=40587&edit=1