ID: 37211 User updated by: idbaxter at semdesigns dot com Reported By: idbaxter at semdesigns dot com -Status: Bogus +Status: Open Bug Type: Documentation problem Operating System: Windows PHP Version: Irrelevant New Comment:
Your "technical" defintion of statement doesn't help. The issue is, can I use require_once and include_once as functions inside the if condition clause? I clearly cannot use a "if statement" inside that condition clause. Yet the sample code appears to treat require_once etc. as *value* returning functions. Are require_once and include_once value returning functions? If so, what value do they return? (The docs imply that they do not, and therefore cannot be used in an expression context.) I think there's two problems here: 1) what is the intended definition? 2) What does the documentation say? Previous Comments: ------------------------------------------------------------------------ [2006-04-26 18:37:54] [EMAIL PROTECTED] PHP manual definition of a statement: "A statement can be an assignment, a function call, a loop, a conditional statement or even a statement that does nothing (an empty statement)." require fits in this definition. ------------------------------------------------------------------------ [2006-04-26 17:04:42] idbaxter at semdesigns dot com Description: ------------ The online manual clearly states that require_once (and related actions such as include) are *statements*. There is no documented return value. It also states that "if" is a *statement*. But actual code sample (from a running system) shows that require_once (and related actions such as include) can be used like a function (see attached code), and even odder, the "@" operator can suppress errors. Now, you can't do that with "if" statement. So, if require_once is a statement, you shouldn't be able to do that. If it is a function, it should be documented as such. So, is the following code wrong? Reproduce code: --------------- <?php if (! require_once /* require_once as a function */(APP_ROOT_DIR.'EcWebFramework/conf/Includes.php')) { $msg = 'Can not load Includes - check filesystem.'; error_log($msg); die($msg); } @include_once( $includePath ) ; /* @ supressess error */ if( [EMAIL PROTECTED]( $include_file ) ) / *both wierdnesses */ { $this->__errorAlert( 'TemplatePower Error: Couldn\'t include script [ '. $include_file .' ]!' ); exit(); } Expected result: ---------------- I expected to get a complaint about illegal syntax. Actual result: -------------- Above code runs without complaint. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37211&edit=1