ID:               15438
 Updated by:       [EMAIL PROTECTED]
 Reported By:      michael at gamepoint dot net
-Status:           Verified
+Status:           Closed
 Bug Type:         Documentation problem
 Operating System: FreeBSD/Linux
 PHP Version:      4.3.2RC4-dev
 New Comment:

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation
better.

"Because include() is a special language costruct, parentheses are not
needed around its argument. Take care when comparing return value.
<?php
// won't work, evaluated as include(('vars.php') == 'OK'), i.e.
include('')
if (include('vars.php') == 'OK') {
    echo 'OK';
}

// works
if ((include 'vars.php') == 'OK') {
    echo 'OK';
}
?>



Previous Comments:
------------------------------------------------------------------------

[2004-05-20 17:56:12] [EMAIL PROTECTED]

I would just mark this bug as Won't fix.

------------------------------------------------------------------------

[2004-05-20 17:46:29] [EMAIL PROTECTED]

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


------------------------------------------------------------------------

[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.

------------------------------------------------------------------------

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

Reply via email to