#18645 [NEW]: dot-operator allows bogus operations with shortcut for if
| From: | alpha at rrs dot at | Date: | Tue, 30 Jul 2002 13:01:45 +0000 |
| Subject: | #18645 [NEW]: dot-operator allows bogus operations with shortcut for if | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-15567@lists.php.net to get a copy of this message | ||
From: alpha@rrs.at
Operating system: windows 2000
PHP version: 4.2.1
PHP Bug Type: Scripting Engine problem
Bug description: dot-operator allows bogus operations with shortcut for if
given this code
<?php
$var = 5;
echo "string1 ".empty($var)?0:$var." string2";
// output "0" - WRONG
echo "<br>";
echo "string1 ".(empty($var)?0:$var)." string2<br>";
// output "string1 5 string2"
echo "<br>";
echo 'string1 '.empty($var)?0:$var.' string2';
// output "0" - WRONG
echo '<br>';
echo 'string1 '.(empty($var)?0:$var).' string2<br>';
// output "string1 5 string2"
echo '<br>';
?>
I get an error-message if I try
echo 'string1 '.empty($var)?0.' string2';
or just
echo 'string1 '.0.' string2';
, thus there is a missing error check at parse time. I don't know enough
about the internal functions of PHP to say if it's the scripting engine or
something else. See yourself ...
--
Edit bug report at http://bugs.php.net/?id=18645&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18645&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18645&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18645&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18645&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18645&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18645&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18645&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18645&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18645&r=globals