@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update Figlet implementation to be PHP8 compatible

Summary:
As of PHP ~v8 the zip_open and associated functions have been deprecated and
removed. The replacement is the ZipArchive API. This updates the figlet
implementation to use this API which has been present in PHP since 5.2.

Additionally in PHP 8 the use of squiggly brackets for indexing into arrays
is also deprecated. This updates to remove two uses of squiggly brackets and
replace with square brackets.

These two deprecations would result in being unable to load differential
revisions in which someone had commented using figlet remarkup.

Imported from:

https://secure.phabricator.com/rPd5c63c86e7e4e87d5f72b35b1bdb1e888aea49bc

https://secure.phabricator.com/rPbc6f4786a2e36441d17b765fde8e8e047840bc58

Closes T15289

Test Plan:
Applied these changes to an install and loaded a revision that had comments
where someone utilized figlet remarkup. The revision loaded properly and the
figlet comment rendered properly.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15064, T15289

Differential Revision: https://we.phorge.it/D25142

authored by

Valerio Bozzolan and committed by
Christopher Speck
71e4eee2 cb938d86

+14 -11
+13 -10
externals/pear-figlet/Text/Figlet.php
··· 140 140 if (!$compressed) { 141 141 /* ZIPed font */ 142 142 if (fread($fp, 2) == 'PK') { 143 - if (!function_exists('zip_open')) { 144 - return self::raiseError('Cannot load ZIP compressed fonts since' 145 - . ' ZIP PHP extension is not available.', 146 - 5); 143 + fclose($fp); 144 + 145 + $zip = new ZipArchive(); 146 + 147 + $zip_flags = 0; 148 + if(defined('ZipArchive::RDONLY')) { 149 + $zip_flags = ZipArchive::RDONLY; // Flag available since PHP 7.4, unnecessary before 147 150 } 148 151 149 - fclose($fp); 150 - 151 - if (!($fp = zip_open($filename))) { 152 - return self::raiseError('Cannot open figlet font file ' . $filename, 2); 152 + $open_result = $zip->open($filename, $zip_flags); 153 + if ($open_result !== true) { 154 + return self::raiseError('Cannot open figlet font file ' . 155 + $filename . ', got error: ' . $open_result, 2); 153 156 } 154 157 155 - $name = zip_entry_name(zip_read($fp)); 156 - zip_close($fp); 158 + $name = $zip->getNameIndex(0); 159 + $zip->close(); 157 160 158 161 if (!($fp = fopen('zip://' . realpath($filename) . '#' . $name, 'rb'))) { 159 162 return self::raiseError('Cannot open figlet font file ' . $filename, 2);
+1 -1
src/docs/user/installation_guide.diviner
··· 124 124 - PHP (usually "php") 125 125 - Required PHP extensions: mbstring, iconv, mysql (or mysqli), curl, pcntl 126 126 (these might be something like "php-mysql" or "php5-mysqlnd") 127 - - Optional PHP extensions: gd 127 + - Optional PHP extensions: gd, zip 128 128 129 129 If you already have LAMP setup, you've probably already got everything you need. 130 130 It may also be helpful to refer to the install scripts above, even if they don't