HomePhabricator

Fall back to from utf8_decode to phutil_utf8v for codepoint counting

Description

Fall back to from utf8_decode to phutil_utf8v for codepoint counting

Summary:
The php7.0 package in Ubuntu 16.04 splits out the php7.0-xml package, which
provides the utf8_decode function. As such, parts of Arcanist throw
exceptions -- most notably PhutilArgumentSpellingCorrector:

$ arc dieff
[2017-01-12 14:57:25] EXCEPTION: (Error) Call to undefined function utf8_decode() at [<phutil>/src/utils/utf8.php:259]
arcanist(head=master, ref.master=d6e112aecf93), phutil(head=master, ref.master=ab80dcf99c6b)
  #0 phutil_utf8_strlen(string) called at [<phutil>/src/parser/argument/PhutilArgumentSpellingCorrector.php:120]
  #1 PhutilArgumentSpellingCorrector::correctSpelling(string, array) called at [<arcanist>/src/configuration/ArcanistConfiguration.php:148]
  #2 ArcanistConfiguration::selectWorkflow(string, array, ArcanistConfigurationManager, PhutilConsole) called at [<arcanist>/scripts/arcanist.php:193]

Since spelling correction is a core feature, and working out-of-the-box is
desirable, fall back to implementing phutil_utf8_strlen in terms of
phutil_utf8v if decode_utf8 is not present.

Fixes: T11713.

Test Plan:
Ran arc dieff on an Ubuntu 16.04 machine after `apt-get
install php7.0-cli`, as well as on PHP 5.5.

Reviewers: Blessed Reviewers, epriestley

Reviewed By: Blessed Reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D17188

Details

Provenance
alexmvAuthored on Jan 12 2017, 2:51 PM
alexmvPushed on Jan 12 2017, 3:32 PM
Reviewer
Blessed Reviewers
Differential Revision
D17188: Fall back to from utf8_decode to phutil_utf8v for codepoint counting
Parents
rPHUe4b06e06ee78: Stop hardcoding the YACC error message
Branches
Unknown
Tags
Unknown
Build Status
Buildable 15225
Build 20013: Run Core Tests