Re: Bug in digest_md5_parse_challenge
"Pablo Álvarez de Sotomayor Posadillo" <[email protected]>
| Newsgroups | gmane.mail.squirrelmail.devel |
|---|---|
| Message-ID | <[email protected]> |
Paul> If base64_decode() returns FALSE, then !== should catch it.
Paul> Can you explain why !== does not work?
Well, you are right, that solve the bug, but it still remain another
bug, and I discovered it now, when I've check why with the !=
condition turn off the warnings and with !== still remain. The new bug
is produced because the while loops once more than the neccesary, that
is, in each while loop the function substract one part of the
$challenge string, so when the string is empty it shows a message
warning about that (the exact message is " Uninitialized string
offset: 0"). The program pass the !== condition if the variables are
not equals or not of the same type, so, in the case described, a
boolean type is diferent from a string type, passing the condition. In
the other hand, with the != condition your are doing an underlying
cast and the while stops at the correct loop. Remember that an empty
string ("") is considered as FALSE in a cast conversion. So, finally,
or you put one != condition or you put two !== condition (one with the
boolean comparision and another one with the string comparision), but
in the first case it's recommended a comment explaining that
comparision.
regards
--
Pablo Álvarez de Sotomayor Posadillo
Ingeniero Técnico en Informática de Sistemas
http://ritho.net
"De todas las cosas que he perdido la que
mas hecho de menos es mi cerebro"
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: [email protected]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel