git: 9ef2994967fc - main - devel/phabricator: Fix PHP 8.1+ deprecation errors

From: Michael Gmelin <grembo_at_FreeBSD.org>
Date: Tue, 31 Jan 2023 18:53:04 UTC
The branch main has been updated by grembo:

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

commit 9ef2994967fce142b7065ada94dfe5d8cfa1a010
Author:     Michael Gmelin <grembo@FreeBSD.org>
AuthorDate: 2023-01-31 17:29:41 +0000
Commit:     Michael Gmelin <grembo@FreeBSD.org>
CommitDate: 2023-01-31 18:51:50 +0000

    devel/phabricator: Fix PHP 8.1+ deprecation errors
    
    Also depend on a version of arcanist-lib that suppresses "string is
    NULL" deprecation errors.
    
    While there, move the only external patch from github into files
    (makes using `make makepatch` less error-prone).
---
 devel/phabricator/Makefile                         |  6 ++--
 devel/phabricator/distinfo                         |  4 +--
 ...externals_stripe-php_lib_Stripe_ApiResource.php | 11 +++++++
 ..._stripe-php_lib_Stripe_SingletonApiResource.php | 11 +++++++
 ...nduit_DiffusionHistoryQueryConduitAPIMethod.php | 11 +++++++
 ...ations_herald_phid_HeraldTranscriptPHIDType.php | 11 +++++++
 ..._editor_PhabricatorProjectTransactionEditor.php | 36 ++++++++++++++++++++++
 ...arkup_blockrule_PhutilRemarkupListBlockRule.php | 11 +++++++
 devel/phabricator/files/pkg-message.in             |  6 ++++
 9 files changed, 100 insertions(+), 7 deletions(-)

diff --git a/devel/phabricator/Makefile b/devel/phabricator/Makefile
index ebb9459890e4..4a8b304777f5 100644
--- a/devel/phabricator/Makefile
+++ b/devel/phabricator/Makefile
@@ -1,11 +1,9 @@
 PORTNAME=	phabricator
 PORTVERSION=	20211218
+PORTREVISION=	1
 CATEGORIES=	devel
 PKGNAMESUFFIX=	${PHP_PKGNAMESUFFIX}
 
-PATCH_SITES=	https://github.com/grembo/phabricator/commit/
-PATCHFILES=	0851b89eb6633dd792cd4eb10c26f86c2f0da56a.patch:-p1
-
 MAINTAINER=	grembo@FreeBSD.org
 COMMENT=	Open source, software engineering platform
 WWW=		https://www.phacility.com/phabricator/
@@ -13,7 +11,7 @@ WWW=		https://www.phacility.com/phabricator/
 LICENSE=	APACHE20
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-RUN_DEPENDS=	arcanist-lib${PHP_PKGNAMESUFFIX}>=20210113_1:devel/arcanist-lib@${PHP_FLAVOR} \
+RUN_DEPENDS=	arcanist-lib${PHP_PKGNAMESUFFIX}>=20210113_4:devel/arcanist-lib@${PHP_FLAVOR} \
 		git:devel/git
 
 USES=		cpe php:cli,flavors shebangfix
diff --git a/devel/phabricator/distinfo b/devel/phabricator/distinfo
index 0af7b269e6eb..2bfe2c303158 100644
--- a/devel/phabricator/distinfo
+++ b/devel/phabricator/distinfo
@@ -1,5 +1,3 @@
-TIMESTAMP = 1646412485
+TIMESTAMP = 1675186465
 SHA256 (phacility-phabricator-20211218-dec9522_GH0.tar.gz) = 2b81f68c2fa142f14ca47fa317354381caf29c28dcef1d8d82de46256d87afa4
 SIZE (phacility-phabricator-20211218-dec9522_GH0.tar.gz) = 9413445
-SHA256 (0851b89eb6633dd792cd4eb10c26f86c2f0da56a.patch) = 6bc4fc545658ba612a6decf7daa7033e5471313960f04db33d9d3b9c99308202
-SIZE (0851b89eb6633dd792cd4eb10c26f86c2f0da56a.patch) = 3502
diff --git a/devel/phabricator/files/patch-externals_stripe-php_lib_Stripe_ApiResource.php b/devel/phabricator/files/patch-externals_stripe-php_lib_Stripe_ApiResource.php
new file mode 100644
index 000000000000..9c1a5f105445
--- /dev/null
+++ b/devel/phabricator/files/patch-externals_stripe-php_lib_Stripe_ApiResource.php
@@ -0,0 +1,11 @@
+--- externals/stripe-php/lib/Stripe/ApiResource.php.orig	2021-12-18 19:11:09 UTC
++++ externals/stripe-php/lib/Stripe/ApiResource.php
+@@ -59,7 +59,7 @@ abstract class Stripe_ApiResource extends Stripe_Objec
+   public static function classUrl($class)
+   {
+     $base = self::_scopedLsb($class, 'className', $class);
+-    return "/v1/${base}s";
++    return "/v1/{$base}s";
+   }
+ 
+   /**
diff --git a/devel/phabricator/files/patch-externals_stripe-php_lib_Stripe_SingletonApiResource.php b/devel/phabricator/files/patch-externals_stripe-php_lib_Stripe_SingletonApiResource.php
new file mode 100644
index 000000000000..9f3d08b484f5
--- /dev/null
+++ b/devel/phabricator/files/patch-externals_stripe-php_lib_Stripe_SingletonApiResource.php
@@ -0,0 +1,11 @@
+--- externals/stripe-php/lib/Stripe/SingletonApiResource.php.orig	2021-12-18 19:11:09 UTC
++++ externals/stripe-php/lib/Stripe/SingletonApiResource.php
+@@ -16,7 +16,7 @@ abstract class Stripe_SingletonApiResource extends Str
+   public static function classUrl($class)
+   {
+     $base = self::className($class);
+-    return "/v1/${base}";
++    return "/v1/{$base}";
+   }
+ 
+   /**
diff --git a/devel/phabricator/files/patch-src_applications_diffusion_conduit_DiffusionHistoryQueryConduitAPIMethod.php b/devel/phabricator/files/patch-src_applications_diffusion_conduit_DiffusionHistoryQueryConduitAPIMethod.php
new file mode 100644
index 000000000000..2dad984b8f7e
--- /dev/null
+++ b/devel/phabricator/files/patch-src_applications_diffusion_conduit_DiffusionHistoryQueryConduitAPIMethod.php
@@ -0,0 +1,11 @@
+--- src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php.orig	2021-12-18 19:11:09 UTC
++++ src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php
+@@ -55,7 +55,7 @@ final class DiffusionHistoryQueryConduitAPIMethod
+     $limit = $request->getValue('limit');
+ 
+     if (strlen($against_hash)) {
+-      $commit_range = "${against_hash}..${commit_hash}";
++      $commit_range = "{$against_hash}..{$commit_hash}";
+     } else {
+       $commit_range = $commit_hash;
+     }
diff --git a/devel/phabricator/files/patch-src_applications_herald_phid_HeraldTranscriptPHIDType.php b/devel/phabricator/files/patch-src_applications_herald_phid_HeraldTranscriptPHIDType.php
new file mode 100644
index 000000000000..5b1012c9f3b1
--- /dev/null
+++ b/devel/phabricator/files/patch-src_applications_herald_phid_HeraldTranscriptPHIDType.php
@@ -0,0 +1,11 @@
+--- src/applications/herald/phid/HeraldTranscriptPHIDType.php.orig	2021-12-18 19:11:09 UTC
++++ src/applications/herald/phid/HeraldTranscriptPHIDType.php
+@@ -35,7 +35,7 @@ final class HeraldTranscriptPHIDType extends Phabricat
+       $id = $xscript->getID();
+ 
+       $handle->setName(pht('Transcript %s', $id));
+-      $handle->setURI("/herald/transcript/${id}/");
++      $handle->setURI("/herald/transcript/{$id}/");
+     }
+   }
+ 
diff --git a/devel/phabricator/files/patch-src_applications_project_editor_PhabricatorProjectTransactionEditor.php b/devel/phabricator/files/patch-src_applications_project_editor_PhabricatorProjectTransactionEditor.php
new file mode 100644
index 000000000000..dac62c904051
--- /dev/null
+++ b/devel/phabricator/files/patch-src_applications_project_editor_PhabricatorProjectTransactionEditor.php
@@ -0,0 +1,36 @@
+--- src/applications/project/editor/PhabricatorProjectTransactionEditor.php.orig	2021-12-18 19:11:09 UTC
++++ src/applications/project/editor/PhabricatorProjectTransactionEditor.php
+@@ -352,10 +352,32 @@ final class PhabricatorProjectTransactionEditor
+       // parent project, since this is the governing rule.
+ 
+       $parent = $copy->getParentProject();
++      if ($parent != null) {
++        $parent_phid = $parent->getPHID();
++      } else { // can happen when using conduit API
++          foreach ($xactions as $xaction) {
++            if ($xaction->getTransactionType() != PhabricatorProjectMilestoneTransaction::TRANSACTIONTYPE) {
++              continue;
++            }
++            $parent_phid = (string)$xaction->getNewValue();
++            $project = id(new PhabricatorProjectQuery())
++              ->setViewer($this->getActor())
++              ->withPHIDs(array($parent_phid))
++              ->requireCapabilities(
++                array(
++                  PhabricatorPolicyCapability::CAN_VIEW,
++                  PhabricatorPolicyCapability::CAN_EDIT,
++                ))
++              ->executeOne();
+ 
++            $copy->attachParentProject($project);
++            $copy->setParentProjectPHID($parent_phid);
++        }
++      }
++
+       $parent = id(new PhabricatorProjectQuery())
+         ->setViewer($this->getActor())
+-        ->withPHIDs(array($parent->getPHID()))
++        ->withPHIDs(array($parent_phid))
+         ->needMembers(true)
+         ->executeOne();
+       $members = $parent->getMemberPHIDs();
diff --git a/devel/phabricator/files/patch-src_infrastructure_markup_blockrule_PhutilRemarkupListBlockRule.php b/devel/phabricator/files/patch-src_infrastructure_markup_blockrule_PhutilRemarkupListBlockRule.php
new file mode 100644
index 000000000000..adc982b01449
--- /dev/null
+++ b/devel/phabricator/files/patch-src_infrastructure_markup_blockrule_PhutilRemarkupListBlockRule.php
@@ -0,0 +1,11 @@
+--- src/infrastructure/markup/blockrule/PhutilRemarkupListBlockRule.php.orig	2021-12-18 19:11:09 UTC
++++ src/infrastructure/markup/blockrule/PhutilRemarkupListBlockRule.php
+@@ -446,7 +446,7 @@ final class PhutilRemarkupListBlockRule extends Phutil
+       }
+ 
+       $start_attr = null;
+-      if (ctype_digit($starts_at) && $starts_at > 1) {
++      if ((is_int($starts_at) || ctype_digit($starts_at)) && $starts_at > 1) {
+         $start_attr = hsprintf(' start="%d"', $starts_at);
+       }
+ 
diff --git a/devel/phabricator/files/pkg-message.in b/devel/phabricator/files/pkg-message.in
index f03f06d656cd..3e61caa5537a 100644
--- a/devel/phabricator/files/pkg-message.in
+++ b/devel/phabricator/files/pkg-message.in
@@ -1,6 +1,12 @@
 [
 { type: install
   message: <<EOM
+Make sure to run phabricator using a production PHP configuration,
+e.g., %%PREFIX/etc/php.ini-production, particularly
+using the recommended error_reporting setting for production:
+
+  error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
+
 To run the phabricator daemons from startup, add phd_enable="YES"
 to /etc/rc.conf. You can control the daemons using