Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Symfony\Component\Tui\Tests\Widget\Figlet;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Tui\Exception\InvalidArgumentException;
use Symfony\Component\Tui\Widget\Figlet\FigletFont;
Expand Down Expand Up @@ -95,6 +96,7 @@ public function testLoadNonExistentFile()
FigletFont::load('/nonexistent/path/to/font.flf');
}

#[RequiresPhpExtension('zip')]
public function testLoadZipRejectsOversizedDecompressedEntry()
{
$path = tempnam(sys_get_temp_dir(), 'flf_zip_').'.zip';
Expand Down
4 changes: 4 additions & 0 deletions 4 src/Symfony/Component/Tui/Widget/Figlet/FigletFont.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ private function readCharacterLines(array $lines, int &$lineIndex): ?array
*/
private static function extractFromZip(string $path): string
{
if (!\extension_loaded('zip')) {
throw new InvalidArgumentException('The ZIP extension is required to load FIGlet fonts from ZIP archives.');
}

$zip = new \ZipArchive();

if (true !== $zip->open($path)) {
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.