phutil_utf8_shorten => PhutilUTF8StringTruncator

Summary: Fixes T3307. Clean up the remaining instances and delete the actual function

Test Plan: arc lintypoo

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T3307

Differential Revision: https://secure.phabricator.com/D10390
Highlight numbers in Python import names properly

Summary: This was a typo I made when porting the Pygments lexer.

Test Plan: Made a paste with "import webapp2_extras" and saw that the whole "webapp2_extras" was blue (unlike before, when only "webapp" was).

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10418
Rename base MySQL database connection class

Summary: Ref T5655. Rename `AphrontMySQLDatabaseConnectionBase` to `AphrontBaseMySQLDatabaseConnection` for consistency.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5655

Differential Revision: https://secure.phabricator.com/D10148
Apply some autofix linter rules

Summary: Self explanatory.

Test Plan: Ran `arc lint --everything --apply-patches` essentially.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10432
Update the `JSONLint` API

Summary:
Update the [[https://github.com/Seldaek/jsonlint/ | JSONLint]] external to more closely resemble the upstream. {D9623} patched the library to return an `array` instead of `stdClass`, however this functionality now exists upstream as an optional mode (see [[https://github.com/Seldaek/jsonlint/commit/351e4350171d9c3af292cfb524dd83badb283e62 | 351e4350171d9c3af292cfb524dd83badb283e62]]).

I basically copied the external verbatim and then applied a sequence of patches (the initial patches required for D9622, plus D9633).

Test Plan: Ran unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10433
Add some additional PHP extensions to the compatibility map

Summary: Because why not?

Test Plan: Eyeball it.

Reviewers: btrahan, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10436
Patch the `JSONLint` external to be compatible with PHP 5.2

Summary: The [[https://github.com/Seldaek/jsonlint/ | JSONLint]] external utilizes the shorthand ternary (`?:`) syntax, which is only available from PHP 5.3. Expand the shorthand ternary form into ordinary ternary form to ensure compatibility with PHP 5.2. Depends on D10433.

Test Plan: Not sure how...

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10435
Fix typo in method call

Summary: See D10435.

Auditors: joshuaspence
Minor fix for JSONLint

Summary: In D10435, the [[https://github.com/Seldaek/jsonlint/ | JSONLint]] external was patched in an attempt to ensure PHP 5.2 compatibility. The fact that `$this->lexer->lex()` will produce a different token if invoked a second time was overlooked.

Test Plan: Ran `./bin/arc lint -- src/lint/linter` in rARC.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10448
Apply some autofix linter rules

Summary: Self-explanatory.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10452
Support "tel:" protocol in Remarkup

Summary: Fixes T6057.

Test Plan: Added and executed unit tests.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6057

Differential Revision: https://secure.phabricator.com/D10449
Parse unusual editor URIs with no domain in the way users expect

Summary:
Fixes T6106. See that task for additional dicussion. Specific issue is that if a URI has no path, but does contain a "/" in the query string, `parse_url()` does something unexpected.

```
$ php -r "var_dump(parse_url('idea://open?a=/'));"
array(3) {
  ["scheme"]=>
  string(4) "idea"
  ["host"]=>
  string(7) "open?a="
  ["path"]=>
  string(1) "/"
```

Instead, adjust these URIs so we get a more expected result.

Test Plan: Added failing unit tests and made them pass.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6106

Differential Revision: https://secure.phabricator.com/D10515
Add a `getEndLineNumber` method to the `AASTNode` class

Summary: Adds a `getEndLineNumber` method to the `AASTNode` class. This method supplements the `getLineNumber` method, providing the //ending// line number for a given node.  This feels a little awkward, but it makes D10535 a little nicer.

Test Plan: See D10535.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10534
Update AWS API version

Summary: This updates the AWS API date to a newer version, which means AWS will expose more functionality in responses and requests to their REST API.

Test Plan: Encountered a problem where properties weren't available in the response during Drydock EC2 allocation because of this old version; updated this version and the properties started appearing.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10545
Add a few methods to `AASTNode` and `AASTToken`

Summary: Add a few general purpose methods to the `AASTNode` and `AASTToken` class.

Test Plan: See D10558.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10554
Minor linter fixes

Summary: Apply some linter autofixes.

Test Plan: `arc lint` and `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10566
Update PHP compatibility information

Summary: Let's keep this relatively up-to-date.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10573
Make libphutil compatible with utf8mb4

Summary:
Ref T1191. Two changes here:

  - Try to use the `utf8mb4` character set. Fall back to `utf8` if it's not available. This may be slightly worse for old MySQL, but is far, far easier than trying to keeep a cache around somewhere with availability information.
  - Prepare to transition to `utf8mb4`. I'm just going to switch this over in the future. I considered trying to save the migration state in the environment somewhere, but it gets really, really messy because we have to inspect the migration state in order to build a connection object. There's also no advantage in the overwhelming majority of cases. We can do something more messy here eventually if it ends up being more complicated than I think.

Test Plan: Wrote comments full of emoji locally.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T1191

Differential Revision: https://secure.phabricator.com/D10604
Quiet utf8mb4 warnings when establish MySQL connections

Summary: Fixes T6228. Ref T1191. Some versions of things spew warnings on these calls; I can't reproduce it locally but @fabe reports this resolving it for him in T6228.

Test Plan: Still works fine locally, but no surprises there.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: fabe, epriestley

Maniphest Tasks: T1191, T6228

Differential Revision: https://secure.phabricator.com/D10623
Use normal human units, not "correct" SI units, when parsing MB/GB etc

Summary:
Technically, "KB" is "kilobyte" which is 1000 bytes, and "KiB" is "kibibyte" which is 1024 bytes. I implemented this function "correctly", but in practice we mostly use it to parse things from `php.ini`, `mysql.cnf`, etc., which all use units of 1024 intead of 1000. This ends up being really confusing because you write `128M` in a file (technicall meaning "128 mebibytes") and then a setup warning says `137M` (tehcnically meaning "137 megabytes").

Use the standard normal units that everyone and everything uses instead of the "correct" units. If we have some cause for the "real" SI units later we can mess with this stuff when we hit that.

Test Plan: Saw the setup check in D10630 actually report what I wrote in the file instead of a weird SI value.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

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