From d8a17ca7c213242d4156931da496e1522f7286fd Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 1 Jun 2025 15:45:36 +0200 Subject: [PATCH] Fix test failures in engine_unsafe_empty_string.phpt (#18727) `/./` 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 8333df88d64..fe402b82b57 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)); } }