|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-06-24 14:56 UTC] alan at aondra dot com
Description: ------------ --- From manual page: http://www.php.net/function.function-exists --- The function 'function_exists' does not execute in the order in which the code is evaluated. Not only is this wrong, it allows for the possibility that code could be executed in the incorrect scope. I saw this note on the documentation: "A function name may exist even if the function itself is unusable due to configuration or compiling options (with the image functions being an example)." I looked and found no such configuration or compiling option that would allow for this. Test script: --------------- <?php header('Content-Type: text/plain'); $mystr = 'should not execute'; if(function_exists('myfunc')) { myfunc($mystr); } $mystr = 'execute'; function myfunc($str) { die($str); } myfunc($mystr); Expected result: ---------------- execute Actual result: -------------- should not execute PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 06 09:00:02 2026 UTC |
1. It should be documented on the function_exists page that it does not work as would be expected of pretty much everything else. 2. Even if it is documented, its function still hinges on broken logic. Not that this is a first by any means. See: i.imgur.com/pyDTn2i.jpg i.imgur.com/40VnUX1.png Saying "because you didn't read an unlinked document (existence not hinted) in the manual, and expect sane code, it's not a bug" doesn't mean it's not a bug. It's still a bug.