ID: 41114 Comment by: moron at industrial dot org Reported By: danishzahoor at gmail dot com Status: Open Bug Type: Program Execution Operating System: Linux PHP Version: 4.4.6 New Comment:
include_once is *not* a function so you cannot use it in the way you are attempting to. The brackets are optional so you are really just telling PHP: include_once "lib/file.php" . "<BR>"; i.e. concatenate the stuff at the right then include the contents of the named file. That said, the parser should probably raise an error since technically your code is malformed due to the bracket in the middle. So if there is any bug, it is the parser not complaining about the syntax error. Cheers Previous Comments: ------------------------------------------------------------------------ [2007-04-17 10:43:48] danishzahoor at gmail dot com Description: ------------ Anything string that comes after concat operator will be concaticated in string param of include_once function. Reproduce code: --------------- <?php print "Including file from lib first<BR>"; echo "result = " . include_once("lib/file.php") . "<BR>"; test1(); function test1() { print "Including file from lib inside function.<BR>"; print "result = " . include_once("lib/file.php") . "<BR>"; } ?> Actual result: -------------- PHP 4 ===== Including file from lib first Warning: main(lib/file.php ): failed to open stream: No such file or directory in /var/www/www.mobiletest.com/htdocs/html/php.samnan/php5_tests/test_include_once.php on line 4 Warning: main(): Failed opening 'lib/file.php<BR>' for inclusion (include_path='.:/usr/local/php/lib/php') in /var/www/www.mobiletest.com/htdocs/html/php.samnan/php5_tests/test_include_once.php on line 4 result = Including file from lib inside function. Warning: test1(lib/file.php ): failed to open stream: No such file or directory in /var/www/www.mobiletest.com/htdocs/html/php.samnan/php5_tests/test_include_once.php on line 10 Warning: test1(): Failed opening 'lib/file.php<BR>' for inclusion (include_path='.:/usr/local/php/lib/php') in /var/www/www.mobiletest.com/htdocs/html/php.samnan/php5_tests/test_include_once.php on line 10 result = PHP 5 ===== Including file from lib first Warning: include_once(lib/file.php<BR>) [function.include-once]: failed to open stream: No such file or directory in /var/webuser/php.samnan/temp/test_include_once.php on line 4 Warning: include_once() [function.include]: Failed opening 'lib/file.php<BR>' for inclusion (include_path='./:/usr/local/php/lib/php') in /var/webuser/php.samnan/temp/test_include_once.php on line 4 result = Including file from lib inside function. Warning: include_once(lib/file.php<BR>) [function.include-once]: failed to open stream: No such file or directory in /var/webuser/php.samnan/temp/test_include_once.php on line 10 Warning: include_once() [function.include]: Failed opening 'lib/file.php<BR>' for inclusion (include_path='./:/usr/local/php/lib/php') in /var/webuser/php.samnan/temp/test_include_once.php on line 10 result = ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41114&edit=1