Skip to content

Commit bc6f478

Browse files
committedApr 25, 2023
Fix support for pk-zip compressed figlet font files
Summary: The change from https://secure.phabricator.com/D21860 introduced a PHP error due to an invalid variable reference (`zip` instead of `$zip`). This fixes that issue as well as confirms that pk-zip compressed figlet font files can continue to be used/loaded. Test Plan: 1. I ensured I had numerous figlet font files installed in `resources/figlet/custom` and used `file` to verify that `univers.flf` and `puffy.flf` are pk-zip archives. 2. With this change applied I added a comment with `figlet(font=univers){{{hello}}}` and verified that the comment used the univers font to render `hello`, and like-wise with the `puffy` font. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D21861
1 parent d5c63c8 commit bc6f478

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎externals/pear-figlet/Text/Figlet.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,15 @@ function loadFont($filename, $loadgerman = true)
141141
/* ZIPed font */
142142
if (fread($fp, 2) == 'PK') {
143143
fclose($fp);
144+
144145
$zip = new ZipArchive();
145146
$open_result = $zip->open($filename, ZipArchive::RDONLY);
146147
if ($open_result !== true) {
147148
return self::raiseError('Cannot open figlet font file ' .
148149
$filename . ', got error: ' . $open_result, 2);
149150
}
150-
$name = zip->getNameIndex(0);
151+
152+
$name = $zip->getNameIndex(0);
151153
$zip->close();
152154

153155
if (!($fp = fopen('zip://' . realpath($filename) . '#' . $name, 'rb'))) {

0 commit comments

Comments
 (0)
Failed to load comments.