Edit report at http://bugs.php.net/bug.php?id=54042&edit=1
ID: 54042 Comment by: jballard at natoga dot com Reported by: jballard at natoga dot com Summary: Include within If Statement inputs blank string Status: Bogus Type: Bug Package: Filesystem function related Operating System: Ubuntu 10.04 LTS PHP Version: 5.3.5 Block user comment: N Private report: N New Comment: Further, the "package" chosen, while include() is indeed not a "Filesystem function", was the most appropriate in my mind for the bug. If need be, it can be suggested to be changed to a more appropriate package. Previous Comments: ------------------------------------------------------------------------ [2011-02-18 20:38:54] jballard at natoga dot com Regardless of whether or not this is a function, this is still --unexpected behavior--, indicating a bug. I am not asking for support; I have found a workaround and this bug does not affect me, therefore support would be unnecessary. I realise include_once and include are not functions in the strict sense, but this is STILL unexpected behaviour not found anywhere in the documentation. THIS IS A BUG, NOT A SUPPORT REQUEST. Please read the original post again; I know perfectly well the difference between a support system and the bug system... ------------------------------------------------------------------------ [2011-02-18 13:22:02] [email protected] Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. include_once is not a function; read the manual. ------------------------------------------------------------------------ [2011-02-18 06:43:21] jballard at natoga dot com Description: ------------ PHP Version: 5.3.2-1ubuntu4.7 When using an include() statement within an if statement, PHP always fails with a seemingly blank input. However, when used normally (obviously) it works fine, and when assigning the return value to a variable and then testing the value of the variable, include() works as intended. Something that may or may not be a factor in this bug is that I have appended to the default include path; however, logically in all test cases (both in the actual project and the test script to create this bug report) this seems irrelevant to the bug. Test script: --------------- <?php /* $v = include_once("blank.php"); if(!$v) echo "FAILED"; else echo "SUCCESS"; */ if( include_once("blank.php") != true) echo "FAILED"; else echo "SUCCESS"; ?> Expected result: ---------------- As is, the script should run just like a normal function; why it behaves in this matter only within in an if-then statement is the bug. The script above -should- output FAILED if there is not a script entitled "blank.php", and SUCCESS if there is. Actual result: -------------- The script above, as-is, believes there is a blank string being inputted into the include() call, when in reality there is a perfectly valid filename. If you comment out the second half of the script and uncomment the first part, it works perfectly fine. Error message: Warning: include_once(/natoga/website/www/dev) [function.include-once]: failed to open stream: Not a directory in /natoga/website/www/dev/includeoncebug.php on line 10 Warning: include_once() [function.include]: Failed opening '' for inclusion (include_path='.:/usr/share/php:/usr/share/pear:/natoga/website/www/res') in /natoga/website/www/dev/includeoncebug.php on line 10 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=54042&edit=1
