Page 1 of 1

bug, silly condition statement?

PostPosted: 23. April 2005 20:23
by Seather
could not not find a place to submit bug reports so i decided to post here.

in htdocs\pdf\pdf.php, i'm rather certain that conditional statement isn't doing what it was intented to do.

Code: Select all
if ($value2 != "" || $value2 != " ")


this statement had me a bit confused at first, but after further thought and a test i can say with certainty that it is messed up.

Code: Select all
<?

if ($value2 != "" || $value2 != " ")
{ echo('true'); }
else
{ echo('false'); }

$value2 = "";
if ($value2 != "" || $value2 != " ")
{ echo('true'); }
else
{ echo('false'); }

$value2 = " ";
if ($value2 != "" || $value2 != " ")
{ echo('true'); }
else
{ echo('false'); }

$value2 = "1";
if ($value2 != "" || $value2 != " ")
{ echo('true'); }
else
{ echo('false'); }

?>


output:
truetruetruetrue

have a nice day.

PostPosted: 07. May 2005 22:57
by Dean
Hi there - I see you haven't received a reply so I thought I would just chip in to *BUMP* your message.

I agree entirely with your assessment. I don't know whether this has already been corrected though.

Essentially the if is guaranteed to return true because if value2 is either <empty> or <space> one or other of the conditions is met. If value two is some other value BOTH conditions will be true.

Dean.