|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-04-07 08:06 UTC] batera at linux dot ime dot usp dot br
The best whay to show you my problem is send you my example.
This expression works as expected:
<?
if (!isset($usuario) OR $usuario != $login OR $usuario == 'logoff' OR $user_senha != $senha OR $user_senha == 'null') {
echo "okokok";
}
else
echo "corrigido!";
?>
but, when I remove the 'else', 'if', tha in first was false, become true.
<?
if (!isset($usuario) OR $usuario != $login OR $usuario == 'logoff' OR $user_senha != $senha OR $user_senha == 'null') {
echo "ppp";
}
?>
I'll go back to php 3.1 'cause I need it working.
Please, let me know when this bug is fixed.
tx a lot.
you allways have done a grate job!
best wishes
OgRo
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 13 08:00:01 2025 UTC |
You have a syntax error in your script. It says: if (!isset($usuario) OR $usuario != $login (...) ^^ It should say: if (!isset($usuario) OR $usuario !== $login (...) ^^^Hello. The same problem happened in php 4.3.1. Anyway, let me explain you better why I think it may be a bug. First, why should it be '!==' instead of '!='?! I'm not comparing types, only the value! I have this 'if' that should be "false" (i tested the values) and always returns "true" To check if it was a sintax error (before my 1st post), i tryed this: <? $x = 0; if (!isset($usuario)) $x = 1; if ($usuario != $login) $x = 1; if ($usuario == 'logoff') $x = 1; if ($user_senha != $senha) $x = 1; if ($user_senha == 'null') $x = 1; echo $x; ?> At this point I've got what I expected. My next step was to remove the "echo $x" and put $x into an if. <? if ($x) { echo "It's true! \$x == $x"; } ?> And guest what?! The value of $x become 1!!!! So I changed the if to: if ($x == 1) And $x became 1 again. So, I tried: if ($x == 0) And $x became 0!!! As you can see, I used "==", not "="! And, again, I don't whant to check the types! I've put back the "echo $x" before "if ($x)", and now it worked fine! No errors at all! I tried to use some else case, and wrote it: <? if ($x) { echo "It's true! \$x value is $x"; } else { echo "It's false! \$x is $x!"; } ?> Now, gess what was the output?! "It's false! $x is 0!"; Can you belive it?! Maybe it's a hardware failure or something, but it just happened in this unique file! index.php And also, it uses session. I didn't wrote the entire code and it was working in a win98 machine. I've put it in a server with php 4.2.3 and worked. I haven't tested it in my machine with this version of PHP. I gess it's all now. Sorry about my 1st post. Sorry cause I posted 2 times this one. best wishes.