1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-21 22:32:41 +01:00

Fix a PHP 8.1 issue with "phutil_console_strlen()"

Summary: Ref T13588.

Test Plan: Ran unit tests in D21757.

Maniphest Tasks: T13588

Differential Revision: https://secure.phabricator.com/D21758
This commit is contained in:
epriestley 2022-04-19 14:54:29 -07:00
parent 21c44d6bed
commit 1fc4439ca5

View file

@ -314,6 +314,8 @@ function phutil_utf8_strlen($string) {
* @return int The console display length of the string. * @return int The console display length of the string.
*/ */
function phutil_utf8_console_strlen($string) { function phutil_utf8_console_strlen($string) {
$string = phutil_string_cast($string);
// Formatting and colors don't contribute any width in the console. // Formatting and colors don't contribute any width in the console.
$string = preg_replace("/\x1B\[\d*m/", '', $string); $string = preg_replace("/\x1B\[\d*m/", '', $string);