#15438 [Opn->Bgs]: include_once fails when comparing output to a value
| From: | iliaa@php.net | Date: | Tue, 08 Oct 2002 03:17:07 +0000 |
| Subject: | #15438 [Opn->Bgs]: include_once fails when comparing output to a value | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-21777@lists.php.net to get a copy of this message | ||
ID: 15438
Updated by: iliaa@php.net
Reported By: michael@gamepoint.net
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: FreeBSD
PHP Version: 4.1.1
New Comment:
Sorry, but the bug system is not the appropriate forum for asking
support questions. 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
Thank you for your interest in PHP.
You can only check if include/include_once failed or succeeded if the
included file returns a value. This is clearly documented at:
http://www.php.net/manual/en/function.include.php
Previous Comments:
------------------------------------------------------------------------
[2002-02-09 06:17:06] some@gamepoint.net
I'm not sure this is actually a bug. I gather the returned value from
an include is the one you specify in the included file with 'return
$var'
Read more at http://www.php.net/manual/en/function.include.php
about
return() in included files.
If you want to evaluate if an include was succesfull you could add:
$var = true;
return $var
at the end of the included file, but this should also do the trick:
((int) @include_once("../lib/test.php")) or die("Don't exist");
which is probably just a check if there's some warning text just like
michael already demonstrated.
------------------------------------------------------------------------
[2002-02-08 10:51:58] derick@php.net
Actually you can check if an include failed or not like this, but I
think the parser gets confused if you use the '== false'.
Making this a scripting engine problem.
Derick
------------------------------------------------------------------------
[2002-02-08 09:48:32] sander@php.net
RTM! You can't include_once check for succes on include/include_once.
include(_once) is not a function.
------------------------------------------------------------------------
[2002-02-07 17:21:40] michael@gamepoint.net
When trying to check if include_once succeeded i came up the following
bug (i believe):
if( include_once("test1.php") == false ) {
print "Failed to include file";
}
Warning: Failed opening '' for inclusion
(include_path='.:/usr/local/lib/php') in /usr/home/michael/www/bug.php
on line 6
Removing '== false' removes the problem.
My configuration is:
FreeBSD 4.5
Apache 1.3.22
PHP 4.1.1
Configure options: './configure' '--with-mysql' '--with-apxs'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=15438&edit=1