From cbf193c2508385900ab8b891ddfa8563ee547c94 Mon Sep 17 00:00:00 2001 From: flip111 Date: Tue, 3 Dec 2013 10:16:17 +0100 Subject: [PATCH] Update Generator.php When string length > 1 (5) and only one character ('a') has been given the correct return value should be a string with only that character ('aaaaa'). Ok sure there is nothing random about that, but that's more likely a case to throw a logic exception or something similar. --- lib/RandomLib/Generator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/RandomLib/Generator.php b/lib/RandomLib/Generator.php index 85e975c..8a19860 100644 --- a/lib/RandomLib/Generator.php +++ b/lib/RandomLib/Generator.php @@ -146,7 +146,7 @@ public function generateInt($min = 0, $max = PHP_INT_MAX) { * @return string The generated random string */ public function generateString($length, $characters = '') { - if ($length == 0 || strlen($characters) == 1) { + if ($length == 0 || strlen($characters) == 0) { return ''; } elseif (empty($characters)) { // Default to base 64