Skip to content

Commit 2ff565a

Browse files
author
Daniel Kozlowski
committed
[php8.2][compatability] Changes to support php 8.2
Remove depricated utf8_decode function call Explicit cast to int for result of division
1 parent fbe0274 commit 2ff565a

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/land/engine/ArcanistPhlqLandEngine.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ function execute() {
213213
$timestamp_diff = $commit_unix_date - $diff_date_modified;
214214
# allow for small theshold before tripping the warning
215215
if ($timestamp_diff > 5) {
216-
$pretty_diff = sprintf('%02dh %02dm %02ds', ($timestamp_diff/3600),($timestamp_diff/60%60), $timestamp_diff%60);
216+
$pretty_diff = sprintf('%02dh %02dm %02ds',$timestamp_diff/3600,(int)($timestamp_diff/60) % 60, $timestamp_diff%60.0);
217+
217218
echo tsprintf(
218219
"\n%!\n%W\n",
219220
pht('POTENTIAL UNPUSHED LOCAL CHANGES FOR D%s', $revision_id),

src/utils/utf8.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,11 @@ function phutil_is_utf8_slowly($string, $only_bmp = false) {
288288
* @return int The character length of the string.
289289
*/
290290
function phutil_utf8_strlen($string) {
291-
if (function_exists('utf8_decode')) {
292-
return strlen(utf8_decode($string));
293-
}
291+
//utf8_decode is depricated as of php 8.2
292+
//https://www.php.net/releases/8.2/en.php#deprecations_and_bc_breaks
293+
//if (function_exists('utf8_decode')) {
294+
// return strlen(utf8_decode($string));
295+
//}
294296
return count(phutil_utf8v($string));
295297
}
296298

0 commit comments

Comments
 (0)