Skip to content

Commit 86f2449

Browse files
Replace Str::random() call with simple inline generator
The use of `Str::random()` within the validator can lead to non-deterministic test outcomes when using random string mocking such as `Str::createRandomStringsUsing()` or `Str::createRandomStringsUsingSequence()`. This simple inline generator needn't be cryptographically secure in this context as we only need a unique placeholder string.
1 parent 3ec3361 commit 86f2449

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Illuminate/Validation/Validator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ public function __construct(
345345
array $attributes = [],
346346
) {
347347
if (! isset(static::$placeholderHash)) {
348-
static::$placeholderHash = Str::random();
348+
static::$placeholderHash = substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'), 0, 16);
349349
}
350350

351351
$this->initialRules = $rules;

0 commit comments

Comments
 (0)