#15438 [Ver]: include_once fails when comparing output to a value

From: Date: Thu, 20 May 2004 15:56:13 +0000
Subject: #15438 [Ver]: include_once fails when comparing output to a value
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969360729@lists.php.net to get a copy of this message
ID: 15438 Updated by: nlopess@php.net 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: I would just mark this bug as Won't fix. Previous Comments: ------------------------------------------------------------------------ [2004-05-20 17:46:29] sean@php.net 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] derick@php.net Just a doc problem... (afaik we came to this conclusion before...) ------------------------------------------------------------------------ [2003-05-18 13:21:58] sniper@php.net 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] andi@php.net 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 (andi@zend.com) ------------------------------------------------------------------------ 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

« previous php.doc (#969360729) next »