Revert "HHVM extension: Fix UTF-8 error recovery in json_encode."

This reverts commit b4b1dd707e83d510e21009b5ec870dd60bd31c75.

Its causing every diff to fail flib tests.

Reviewed By: @bgogul
add a test for interaction of async and finally

... to better expose issues with the behavior of the two.

Reviewed By: @jano

Differential Revision: D1246942
Tweak compare-ir to remove more irrelevant differences

I've been using this a lot to find perf regressions in the
control flow stuff.

Reviewed By: @edwinsmith

Differential Revision: D1249105
Fix a bug when decodeCufIterHelper throws

It needed a catch trace (although it can only throw
if autoload occurs, *and* it throws).

Reviewed By: @jdelong

Differential Revision: D1250436
Reshape FrameState's interface a little bit

This is in preparation for making the refcount optimizer unit-testable.
It needs to be able to construct a SinkPointAnalyzer without a real
Func.

- I made a few tweaks to FrameState's interface, mostly in deleting its
  default copy ctor and copy assignment operator, to make sure nobody
  accidentally uses them (they'll be copying a bunch of stuff that
  probably isn't meant to be copied). It also doesn't need an explicitly
  declared/defined destructor.

- The FrameState(IRUnit&) ctor was a bit counter to my aims: I want it
  to be clear when you're constructing a FrameState with and without a
  valid BCMarker. It was only used in two places, so I inlined it into
  those two places.

- SinkPointAnalyzer now takes a FrameState object explicitly, to
  (hopefully) restrict knowledge of whether we're dealing with real
  BCMarkers or not to the higher level (optimizeRefcounts).

Reviewed By: @bertmaher

Differential Revision: D1249856
Fix assertion failure with wrong type param arity

We wanted to assert that, when using a class, its methods
have the right arity. However, that check currently happens during the
typing phase, and so depending on ordering there's a chance that some
callsite might consume the return type with a wrong arity before we can
check that it's correct. Furthermore this check can't be moved up into
declaration since we need to get the typeclass of the target class in
order to determine what the arity should be in the first place. (I
suppose we could use the nast for this, but that sounds annoying.) So we
could define a new phase where this is checked and where we don't go
into typing if it fails... or we could just remove the asserts and let
typing deal with spewing the type errors later. We already are at least
intended to do something reasonable on arity mismatch since we omit this
check in silent mode anyways.

Reviewed By: @gabelevi

Differential Revision: D1246487
Corrected ENT_IGNORE and ENT_SUBSTITUTE behaviors for UTF8 strings

`htmlspecialchars` was incorrectly aborting escaping of UTF8 characters whenever `ENT_IGNORE` was passed in because of bad checks.
This diff corrects that behavior.
This diff also implements support for `ENT_SUBSTITUTE` since the functionality is very similar.

Fixes #2186 and #2262

Reviewed By: @ptarjan

Differential Revision: D1250810
Fix a bug in register_variable

The second lvalAt line doesn't necessarily return the same
array offset that the append call created if the nextKI wasn't in sync
with the array size.  I didn't entirely think through why the repro
case hit this, but this version doesn't and is more correct.

Reviewed By: @edwinsmith

Differential Revision: D1249471
build limited non-Linux version of Hack

Stubbed out some Linux-specific dependencies in Hack (inotify,hh_shared).
Note: this is not intended to be a general solution for running Hack on OSX.

Reviewed By: @jwatzman

Differential Revision: D1247209
Look transitively through nullable chains.

This causes `??T` to be treated as `?T` for the purpose of null checking.

Reviewed By: @gabelevi

Differential Revision: D1250188
Fix another assert crash

Followup to D1246487.

Reviewed By: @gabelevi

Differential Revision: D1252520
Unrevert "Fix bug in way function types are serialized to the Code Model."

This is a partial unrevert of "Fix bug in way function types are serialized
to the Code Model". The fix to CodeModelToPHP::visitTypeExpression() could
not be restored because the CodeModelToPHP class is not built into HHVM at
present.

Reviewed By: @ptarjan
repo mode: check trait requirements after all other traits applied

... since a (textually later) "use ProvidingTrait;" can
 result in a class implementing an interface and thus satisfy the
 'require interface' of a textually earlier "use RequiringTrait;".

Reviewed By: @paroski

Differential Revision: D1250792
Support (?FormatString<Foo> $foo = null)

the error message for this wasn't very helpful

Reviewed By: @jwatzman

Differential Revision: D1245985
Unit test for refcount optimizer

The solution was obvious all along: pass a FrameState into
optimizeRefcounts. I like this because it's putting a clue as to the
scope of optimizeRefcounts' work into its interface. It furthers my goal
of separating IRUnit from BCMarker, and thus my higher-level goal of
separating IR from bytecode.

Right now the refcount optimizer's unit test is trivial (can it optimize
IncRef; IncRef; DecRef; DecRef of the same thing?) because I want to
leave the writing of nontrivial tests for a diff without non-test
changes.

Reviewed By: @swtaarrs

Differential Revision: D1251523
Adding WDDX extension (HNI)

Currently has support for wddx_serialize_value() which is the only test left (incomplete) for Ratchet.
Closes #1887

Reviewed By: @fredemmott

Differential Revision: D1245125

Pulled By: @ptarjan
targetting 3.1.0 on master

atm users on hhvm-nightly doesn't get a "correct" version number for `hhvm --version`
Merge pull request #2306 from staabm/patch-1

targetting 3.1.0 on master
Fix incompatible interface implementation error message

This one was a mess. We had a bunch of `Pos.none` lying around,
leading to an incredibly bad error message for the new test case in this
diff (distilled from a case that @KendallHopkins actually hit in real
code). This diff tries to give better witnesses in a lot of cases,
particularly fixing the error message in this case. It still isn't a
**great** error, but it at least is workable now, pointing to the
problem instead of into the ether :)

Reviewed By: @pikatchu

Differential Revision: D1252761
Builtin classes are always persistent

While debugging other issues, I noticed that we were
reading the Class* for Exception from the rds, even though
the handle was clearly a persistent handle.

Found that we were guarding on RepoAuthoritative - but thats
clearly too late (if the Class isn't persistent, for whatever
reason, we should not have allocated a persistent handle).

Reviewed By: @jdelong

Differential Revision: D1253986