bug, silly condition statement?

Problems with the Windows version of XAMPP, questions, comments, and anything related.

bug, silly condition statement?

Postby Seather » 23. April 2005 20:23

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.
Seather
 
Posts: 1
Joined: 23. April 2005 20:02

Postby Dean » 07. May 2005 22:57

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.
Dean
 
Posts: 2
Joined: 07. May 2005 22:40


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 60 guests