|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-04-26 18:37 UTC] vrana@php.net
[2006-05-16 22:45 UTC] idbaxter at semdesigns dot com
[2006-05-16 22:50 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 18 22:00:01 2025 UTC |
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.