Bug 240931 - devel/libphutil: Exception when using with newer PHP (deprecated use of `implode()')
Summary: devel/libphutil: Exception when using with newer PHP (deprecated use of `impl...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Michael Gmelin
Keywords: needs-qa
Depends on:
Reported: 2019-09-30 07:24 UTC by Lutz Donnerhacke
Modified: 2019-10-01 09:48 UTC (History)
1 user (show)

See Also:
grembo: maintainer-feedback+
grembo: merge-quarterly-

utils/utils.php: patch to fix call oder (378 bytes, patch)
2019-09-30 07:24 UTC, Lutz Donnerhacke
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lutz Donnerhacke freebsd_committer 2019-09-30 07:24:29 UTC
Created attachment 207953 [details]
utils/utils.php: patch to fix call oder

Running arc on a newer version of PHP (i.e. 7.4) throws a lot of exceptions. This is currently a cosmetic issue, but will cause real errors in the future.
[2019-09-30 07:00:39] ERROR 8192: implode(): Passing glue string after array is deprecated. Swap the parameters at [/usr/local/lib/php/libphutil/src/utils/utils.php:1706]
arcanist(), phutil()
  #0 implode(array, string) called at [<phutil>/src/utils/utils.php:1706]
  #1 phutil_build_http_querystring_from_pairs(array) called at [<phutil>/src/utils/utils.php:1678]
  #2 phutil_build_http_querystring(array) called at [<phutil>/src/future/http/HTTPSFuture.php:656]
  #3 HTTPSFuture::formatRequestDataForCURL() called at [<phutil>/src/future/http/HTTPSFuture.php:280]
  #4 HTTPSFuture::isReady() called at [<phutil>/src/future/Future.php:37]
  #5 Future::resolve(NULL) called at [<phutil>/src/future/FutureProxy.php:34]
  #6 FutureProxy::resolve() called at [<phutil>/src/conduit/ConduitClient.php:64]
  #7 ConduitClient::callMethodSynchronous(string, array) called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:518]
  #8 ArcanistDiffWorkflow::run() called at [<arcanist>/scripts/arcanist.php:394]
The documentation in https://www.php.net/manual/en/function.implode.php says:

implode ( string $glue , array $pieces ) : string

Note: implode() can, for historical reasons, accept its parameters
in either order. For consistency with explode(), however, it may
be less confusing to use the documented order of arguments.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2019-09-30 07:29:55 UTC
Thank you for the report and patch

Have you searched upstream for issues, commits or patches for this?
Comment 2 Lutz Donnerhacke freebsd_committer 2019-09-30 07:44:58 UTC
(In reply to Kubilay Kocak from comment #1)

Yes, I did search the bug tracker of phabricator (but I do not have an account). There was nothing. I'd assume, that most people stick to older versions of PHP.

I did not check the HEAD of the arcanist source.
Comment 3 commit-hook freebsd_committer 2019-09-30 09:12:57 UTC
A commit references this bug:

Author: grembo
Date: Mon Sep 30 09:12:54 UTC 2019
New revision: 513334
URL: https://svnweb.freebsd.org/changeset/ports/513334

  Fix use of implode() to avoid warnings when running on newer versions
  of PHP.

  See also https://www.php.net/manual/en/function.implode.php
  Committed with minor changes.

  PR:		240931
  Submitted by:	lutz@donnerhacke.de

Comment 4 Michael Gmelin freebsd_committer 2019-09-30 09:31:52 UTC
Thanks for the contribution.

I committed the patch to devel/libphutil with small changes and also opened a pull request upstream:


@koobs Merging to quarterly won't be necessary, as 2019Q4 will be branched this week (probably tomorrow).
Comment 5 Michael Gmelin freebsd_committer 2019-09-30 14:57:33 UTC
Upstream doesn't accept pull requests and getting access to upstream phabricator is limited to few individuals, therefore I opened a report in their forums, let's see if that leads to anything:

Comment 6 Michael Gmelin freebsd_committer 2019-10-01 09:48:54 UTC
Committed upstream in https://secure.phabricator.com/D20846