Other Editions > Other Editions - Bugs

Wrong parameter parsing

(1/1)

pvx:
PasswordMaker PHP edition 1.3 has a bug in argument parsing. All arguments in code are checked with isset() function, but code begins with setting all arguments to empty string (''), so isset() always returns true and default values for arguments are not set.

Which means that unless you set all arguments, PasswordMaker returns empty string (because error checking doesn't report anything to the user).

Quick fix is to remove (comment) the empty-string-init line:


--- Code: ---//$args = array('alg'=>'md5', 'mpw'=>'', 'url'=>'', 'user'=>'', 'mod'=>'', 'len'=>'', 'charset'=>'', 'pfx'=>'', 'sfx'=>'', LEET=>'');
--- End code ---

"Nicer" way would be to replace isset()s with !=''. Also it wouldn't hurt to report errors to the user   (if he enters invalid arguments).

PasswordMaker is a great idea, thanks to all developers!

Miquel 'Fire' Burns:
Changing every !isset with empty should work with the logic the person who wrote that was going for.

Eric H. Jung:
I see miquel has made the change and checked it into Subversion on SourceForge. Thanks, Miquel! Feel free to publish it in a new release.

Navigation

[0] Message Index

Go to full version