Skip to content

Commit c9ef889

Browse files
authored
Merge pull request #3832 from oleibman/findfont2
Addendum to Shared Font
2 parents 6f84f41 + 58ea5b5 commit c9ef889

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/PhpSpreadsheet/Shared/Font.php

+7
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,7 @@ private static function findFontFile(string $startDirectory, string $desiredFont
713713
if (file_exists("$startDirectory/$desiredFont")) {
714714
$fontPath = "$startDirectory/$desiredFont";
715715
} else {
716+
$iterations = 0;
716717
$it = new RecursiveDirectoryIterator(
717718
$startDirectory,
718719
RecursiveDirectoryIterator::SKIP_DOTS
@@ -730,6 +731,12 @@ private static function findFontFile(string $startDirectory, string $desiredFont
730731

731732
break;
732733
}
734+
++$iterations;
735+
if ($iterations > 5000) {
736+
// @codeCoverageIgnoreStart
737+
break;
738+
// @codeCoverageIgnoreEnd
739+
}
733740
}
734741
}
735742

0 commit comments

Comments
 (0)