From f8052cc8a7532f45b748ffe90e04249225d4f73d Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 1 Jun 2025 14:40:05 +0200 Subject: [PATCH] Fix test failures in engine_unsafe_empty_string.phpt `/./` matches all characters but newlines, so if `random_bytes` generates a string with newlines in it, the resulting string is not empty. Fix this by adding the `s` modifier. --- ext/random/tests/03_randomizer/engine_unsafe_empty_string.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/random/tests/03_randomizer/engine_unsafe_empty_string.phpt b/ext/random/tests/03_randomizer/engine_unsafe_empty_string.phpt index 8333df88d6454..fe402b82b57b3 100644 --- a/ext/random/tests/03_randomizer/engine_unsafe_empty_string.phpt +++ b/ext/random/tests/03_randomizer/engine_unsafe_empty_string.phpt @@ -11,7 +11,7 @@ final class EmptyStringEngine implements Engine public function generate(): string { // Create a non-interned empty string. - return preg_replace('/./', '', random_bytes(4)); + return preg_replace('/./s', '', random_bytes(4)); } }