From 6e1344542e85e703bf334d8c4bcc1a63dbcf57eb Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 19 Nov 2024 19:02:39 +0100 Subject: [PATCH] Make regexp more strict and refuse trailing newlines --- src/Key/PrivateKey.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Key/PrivateKey.php b/src/Key/PrivateKey.php index 602ce28d..87bdaa6a 100644 --- a/src/Key/PrivateKey.php +++ b/src/Key/PrivateKey.php @@ -56,7 +56,7 @@ public static function fromFile( ): static { if (preg_match(PEM::PEM_REGEX, $file) !== 1) { // Not a PEM-encoded key. Must be a file - if (preg_match('/^(file:\/\/)/i', $file) !== 1) { + if (preg_match('/^(file:\/\/)/Di', $file) !== 1) { $file = preg_filter('/^/', 'file://', $file); } }