logo       

#22342 [Dup->Bgs]: the behaviour of require(..) or die(..); is non-intuitiv: msg#00484

Subject: #22342 [Dup->Bgs]: the behaviour of require(..) or die(..); is non-intuitive
 ID:               22342
 Updated by:       sniper@xxxxxxx
 Reported By:      peter-phpbug at dataloss dot nl
-Status:           Duplicate
+Status:           Bogus
 Bug Type:         Documentation problem
 Operating System: Linux
 PHP Version:      4.3.1
 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the existing bug instead.

Thank you for your interest in PHP.

Please add your comments to bug #15438

(hartmut, use the quickfix for these.. :)



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

[2003-02-21 05:17:27] hholzgra@xxxxxxx

dup. of #15438

operator precedence problem: or is evaluated before require

i have to confess that the sample doesn't make sense for require, but
it is at least a documentation problem for include:

  include("somefile") or die(...);

whereas 

  (include("somefile")) or die(...);

works as expected

IMHO the WTF factor here is rather big ... :(

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

[2003-02-21 04:51:13] sniper@xxxxxxx

require() dies with fatal error if file is not found..


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

[2003-02-20 18:14:23] peter-phpbug at dataloss dot nl

If one would use a line similar to

require("include/xhtml11.php") or die("argh!");

php will fail stating it cannot open "1".

The more intuitive result can be obtained by doing

(require("include/xhtml11.php")) or die("argh!");

I know that require or die is wrong, since require is not a function.
However, due to the way precedence (apparently) works with require, the
result is non-intuitive and confusing (I am assuming php is evaluating
'(..) or die(..)' to 'true', which is 1).

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


-- 
Edit this bug report at http://bugs.php.net/?id=22342&edit=1


-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe