Edit report at http://bugs.php.net/bug.php?id=54042&edit=1
ID: 54042 Updated by: [email protected] Reported by: jballard at natoga dot com Summary: Include within If Statement inputs blank string -Status: Open +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: 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. Previous Comments: ------------------------------------------------------------------------ [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
