1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-10 00:42:40 +01:00

Fix PHP 8.1 arc patch strlen(null) binary file error

Summary:
Fix issue in arcanist whereby when doing an arc patch involving adding or removing a binary file, it falls over with strlen(null) errors.

Fixes T15617

Test Plan: arc patch Dxxxx

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15617

Differential Revision: https://we.phorge.it/D25409
This commit is contained in:
sten 2023-08-18 10:01:00 +01:00
parent df6c315ace
commit 8b907d7716

View file

@ -762,7 +762,7 @@ final class ArcanistBundle extends Phobject {
$old_data = $this->getBlob($old_phid, $name);
}
$old_length = strlen($old_data);
$old_length = phutil_nonempty_string($old_data) ? strlen($old_data) : 0;
// Here, and below, the binary will be emitted with base85 encoding. This
// encoding encodes each 4 bytes of input in 5 bytes of output, so we may
@ -795,7 +795,7 @@ final class ArcanistBundle extends Phobject {
$new_data = $this->getBlob($new_phid, $name);
}
$new_length = strlen($new_data);
$new_length = phutil_nonempty_string($new_data) ? strlen($new_data) : 0;
$this->reserveBytes($new_length * 5 / 4);
if ($new_data === null) {