PHP 4.0 Bug #4751 Updated: fopen within if is not executed
| From: | Bug Database | Date: | Thu, 01 Jun 2000 11:36:45 +0000 |
| Subject: | PHP 4.0 Bug #4751 Updated: fopen within if is not executed | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-19957@lists.php.net to get a copy of this message | ||
ID: 4751
Updated by: hholzgra
Reported By: s.frings@edvfrings.de
Status: Closed
Bug Type: Misbehaving function
Assigned To:
Comments:
mixing assignments (or any other operation that is
not free of side-effects) with logical operators
is generally not a good idea as php (similar to C
and others) uses an optimization technique called
"lazy evaluation"
so if you have an expression like
expr_a && expr_b
and expr_a evaluates to false, then expr_b is never
evaluated as the overall result of the '&&' would
be false anyway
similar in
expr_a || expr_b
expr_b will not be evaluated if expr_a is true
try for example:
<?
$a="initial";
$b="initial";
(($a=1)||($b=1));
print "a:$a b:$b\n";
?>
so beware!
Full Bug description available at: http://bugs.php.net/version4/?id=4751