ID: 36370 Updated by: [EMAIL PROTECTED] Reported By: rbro at hotmail dot com -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 5.1.2 New Comment:
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 __FUNCTION__ is something handled by the parser, and not the executor. This means that it has no knowlegde where it was included from and as the __FUNCTION__ appears outside of a function declaration it ofcourse returns NULL. Previous Comments: ------------------------------------------------------------------------ [2006-02-12 16:51:06] rbro at hotmail dot com Thanks for the update, but why is this not a bug? I did look at the documentation before submitting this bug and http://us3.php.net/include states the following: "If the include occurs inside a function within the calling file, then all of the code contained in the called file will behave as though it had been defined inside that function." which then contradicts the Actual Result that I'm getting because if I move my included code into the main file, then the output is different: 1. Function is: test 2. Function is: test ------------------------------------------------------------------------ [2006-02-12 14:22:08] [EMAIL PROTECTED] 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 . ------------------------------------------------------------------------ [2006-02-12 04:03:10] rbro at hotmail dot com Description: ------------ If you include a file within a function, the constant __FUNCTION__ is not available from that include file. Reproduce code: --------------- <?php function test() { echo "1. Function is: ".__FUNCTION__."\n"; require('b.php'); } test(); ?> ------- File b.php contains: <?php echo "2. Function is: ".__FUNCTION__."\n"; ?> Expected result: ---------------- 1. Function is: test 2. Function is: test Actual result: -------------- 1. Function is: test 2. Function is: ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36370&edit=1
