|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-11-16 10:13 UTC] indeyets@php.net
Description:
------------
At the moment, call to undefined function results as "Fatal error". On the other hand, it can be easily handled programmatically either by including required file or just defining function dynamically.
Test script:
---------------
<?php
set_error_handler(function($errno , $errstr){
if (strpos($errstr, 'Call to undefined function there_is_no_me()') === 0) {
function there_is_no_me()
{
echo "Here am I!\n";
}
}
});
there_is_no_me();
Expected result:
----------------
Here am I!
Actual result:
--------------
Fatal error: Call to undefined function there_is_no_me()
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 12:00:01 2025 UTC |
What about function_exists() ? set_error_handler(function($errno , $errstr){ if (!function_exists('there_is_no_me')) { function there_is_no_me(){ echo "Here am I!\n"; } } }); lubosdz