File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -318,7 +318,13 @@ public function sanitizeFilename(string $filename): string
318318 );
319319 }
320320 if ($ result === false ) {
321- throw new RuntimeException (preg_last_error_msg () . ' filename: " ' . $ filename . '" ' );
321+ if (version_compare (PHP_VERSION , '8.0.0 ' , '>= ' )) {
322+ $ message = preg_last_error_msg ();
323+ } else {
324+ $ message = 'Regex error. error code: ' . preg_last_error () . '. ' ;
325+ }
326+
327+ throw new RuntimeException ($ message . ' filename: " ' . $ filename . '" ' );
322328 }
323329
324330 // Clean up our filename edges.
Original file line number Diff line number Diff line change @@ -226,7 +226,6 @@ public function testSanitizationFilenameEdges()
226226 public function testSanitizationRegexError ()
227227 {
228228 $ this ->expectException (RuntimeException::class);
229- $ this ->expectExceptionMessage ('Malformed UTF-8 characters, possibly incorrectly encoded filename: ' );
230229
231230 $ test = mb_convert_encoding ('クラスファイル.php ' , 'EUC-JP ' , 'UTF-8 ' );
232231
You can’t perform that action at this time.
0 commit comments