ID: 15438
Updated by: [EMAIL PROTECTED]
Reported By: michael at gamepoint dot net
Status: Verified
Bug Type: Documentation problem
Operating System: FreeBSD/Linux
PHP Version: 4.3.2RC4-dev
New Comment:
it seems that this is actually happening because the following
statement:
if (include_once('file') == FALSE)
is actually being parsed as:
if (include_once ('file' == FALSE))
becasue include_once isn't a true function.
Is that what the docs should say?
S
Previous Comments:
------------------------------------------------------------------------
[2003-05-18 16:31:26] [EMAIL PROTECTED]
Just a doc problem... (afaik we came to this conclusion before...)
------------------------------------------------------------------------
[2003-05-18 13:21:58] [EMAIL PROTECTED]
Simple explanation for Andi:
This does not work:
if (include('bar.inc') == true) {
print "1. ok\n";
}
But this does:
if ((include('bar.inc')) == true) {
print "1. ok\n";
}
Bug or just documentation issue?
------------------------------------------------------------------------
[2002-12-10 11:16:28] rogierbiba at hotmail dot com
Because michael did mention this bug again...
mfisher already did describe what happens when you use
var_dump(include_once("someinclude.inc")) twice.
So what's only left is the weird behaviour from the
if(include_once("test.php") == false) or == true.
when adding a few ()'s it works as expected.
if((include_once("test.php"))== $bool){
echo("file test.php included");
}
when $bool is 'true', it will echo the line, if $bool is 'false' it
will not echo the line.
if the file is not found it will produce a warning, and it will display
the line when $bool is 'false'.
In any case, adding the () around the include() will make the strange
Warning: Failed opening '' for inclusion, or Warning: Failed opening
'1' for inclusion, go away.
------------------------------------------------------------------------
[2002-12-09 06:25:34] [EMAIL PROTECTED]
I still don't understand what the problem is. includee() and friends
are supposed to return whatever you return from within the included
file. It's not supposed to return true or false.
If you have a concrete reproducing script which doesn't work the way I
mentioned please post it and email it to me ([EMAIL PROTECTED])
------------------------------------------------------------------------
[2002-10-14 17:51:04] [EMAIL PROTECTED]
> Updated Version
The include*/require* functions are a bit inconsistent.
In the simple tests done, the filename printed after "Running" is the
statement included in the source and executed by PHP, e.g.
var_dump(require("file2include"));
Every script ran exeutes the same statement twice in a row.
First tests done by including the following:
<?php
echo "File got included\n";
?>
--> Running include.php
File got included
int(1)
File got included
int(1)
--> Running include_once.php
File got included
int(1)
bool(true)
--> Running require.php
File got included
UNKNOWN:0
File got included
UNKNOWN:0
--> Running require_once.php
File got included
int(1)
bool(true)
Same tests ran with:
<?php
echo "File got included\n";
return "Returning a string";
?>
--> Running include.php
File got included
string(18) "Returning a string"
File got included
string(18) "Returning a string"
--> Running include_once.php
File got included
string(18) "Returning a string"
bool(true)
--> Running require.php
File got included
UNKNOWN:0
File got included
UNKNOWN:0
--> Running require_once.php
File got included
string(18) "Returning a string"
bool(true)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/15438
--
Edit this bug report at http://bugs.php.net/?id=15438&edit=1