git: e1abc97d9ede - main - devel/arcanist-lib: Fix `arc patch` on PHP 8.1

From: Michael Gmelin <grembo_at_FreeBSD.org>
Date: Thu, 08 Sep 2022 16:22:29 UTC
The branch main has been updated by grembo:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e1abc97d9ede14c8e14b120de52b350acd77f3f4

commit e1abc97d9ede14c8e14b120de52b350acd77f3f4
Author:     Michael Gmelin <grembo@FreeBSD.org>
AuthorDate: 2022-09-08 16:09:09 +0000
Commit:     Michael Gmelin <grembo@FreeBSD.org>
CommitDate: 2022-09-08 16:21:56 +0000

    devel/arcanist-lib: Fix `arc patch` on PHP 8.1
---
 devel/arcanist-lib/Makefile                          |  1 +
 .../files/patch-src_parser_ArcanistBundle.php        | 20 ++++++++++++++++++++
 ...src_toolset_workflow_ArcanistVersionWorkflow.php} |  0
 3 files changed, 21 insertions(+)

diff --git a/devel/arcanist-lib/Makefile b/devel/arcanist-lib/Makefile
index 3be58fea6b70..3f2065d8d138 100644
--- a/devel/arcanist-lib/Makefile
+++ b/devel/arcanist-lib/Makefile
@@ -1,5 +1,6 @@
 PORTNAME?=	arcanist
 PORTVERSION?=	20220518
+PORTREVISION?=	1
 CATEGORIES?=	devel
 PKGNAMESUFFIX=	${SLAVE_PKGNAMESUFFIX}${PHP_PKGNAMESUFFIX}
 
diff --git a/devel/arcanist-lib/files/patch-src_parser_ArcanistBundle.php b/devel/arcanist-lib/files/patch-src_parser_ArcanistBundle.php
new file mode 100644
index 000000000000..095e1b24ee81
--- /dev/null
+++ b/devel/arcanist-lib/files/patch-src_parser_ArcanistBundle.php
@@ -0,0 +1,20 @@
+--- src/parser/ArcanistBundle.php.orig	2022-09-08 16:04:09 UTC
++++ src/parser/ArcanistBundle.php
+@@ -762,7 +762,7 @@ final class ArcanistBundle extends Phobject {
+       $old_data = $this->getBlob($old_phid, $name);
+     }
+ 
+-    $old_length = strlen($old_data);
++    $old_length = strlen($old_data ?? '');
+ 
+     // 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 = strlen($new_data ?? '');
+     $this->reserveBytes($new_length * 5 / 4);
+ 
+     if ($new_data === null) {
diff --git a/devel/arcanist-lib/files/patch-src-toolset-workflow-ArcanistVersionWorkflow.php b/devel/arcanist-lib/files/patch-src_toolset_workflow_ArcanistVersionWorkflow.php
similarity index 100%
rename from devel/arcanist-lib/files/patch-src-toolset-workflow-ArcanistVersionWorkflow.php
rename to devel/arcanist-lib/files/patch-src_toolset_workflow_ArcanistVersionWorkflow.php