#37211 [NEW]: require_once: a statement or a function?

From: Date: Wed, 26 Apr 2006 17:04:42 +0000
Subject: #37211 [NEW]: require_once: a statement or a function?
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969372788@lists.php.net to get a copy of this message
From: idbaxter at semdesigns dot com Operating system: Windows PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: require_once: a statement or a function? 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( !@include_once( $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 bug report at http://bugs.php.net/?id=37211&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37211&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=37211&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37211&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37211&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37211&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37211&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37211&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37211&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37211&r=support Expected behavior: http://bugs.php.net/fix.php?id=37211&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37211&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37211&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37211&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37211&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37211&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37211&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37211&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37211&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37211&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37211&r=mysqlcfg

« previous php.doc (#969372788) next »