run usercode before ending the request

Summary: Currently, the following happens at the end of a request:
onSendEnd -> run postsend functions -> hphp_context_exit

However, hphp_context_exit can call destructors for objects that are
alive at the end of request. This usercode should be allowed to send
output. This causes a circular reference issue because postsend
functions might need to access those objects.

When we don't have a postsend function, preserve Zend compatibility by
delaying the execution of onSendEnd.

Closes https://github.com/facebook/hhvm/pull/3279

Reviewed By: @markw65

Differential Revision: D1465876

Pulled By: svcscm
Move flaky tests to test/zend/bad

Summary: More of what happened in D1465647

Reviewed By: mcl, bertrand

Differential Revision: D1466742
Fix insertion order in eliminateJmp

Summary: Incrementing the iterator was causing the insertions to happen in kind
of random places.  It seems like the correct thing to do is not to increment.
This probably isn't exercised outside of wholecfg.

Reviewed By: @edwinsmith

Differential Revision: D1463010
PDO MySQL's getCode() didn't match errorInfo

Summary: Fixes #3206

Closes https://github.com/facebook/hhvm/pull/3246

Reviewed By: joelm, fredemmott, ptarjan

Differential Revision: D1447243

Pulled By: svcscm
Catch FailedToListenException from hhprof server startup

Summary: This is probably the source of the uncaught FailedToListenException
that's causing sandbox mode to crash---it's the only call to
Server::start() I can see that's not wrapped in a try-catch.

Reviewed By: @jdelong

Differential Revision: D1465343
Remove restriction on concatenating Tany with a string

Summary: Looks like an old holdover from when strict mode let you do
basically nothing with `Tany`. It's weird, let's just kill it.

Reviewed By: @elgenie

Differential Revision: D1465255
Tag the SilverStripe framework tests to 3.1.5

Summary: Closes https://github.com/facebook/hhvm/pull/3282

Reviewed By: @fredemmott

Differential Revision: D1465874

Pulled By: svcscm
Support AsyncGenerator

Summary: When you yield and await in the same function, you are of type
`AsyncGenerator<Tk, Tv, Ts>` where the generics have the same meaning as
in `Generator<Tk, Tv, Ts>` (yielded key, yielded value, sent value).

Reviewed By: @elgenie

Differential Revision: D1457241
bump third-party after recent folly change
Error if we don't detect an hhconfig when running Hack code

Summary: Lots of folks are "running Hack code" but are utterly unaware
of the typechecker -- and so are accidentally running type-incorrect
code. It's easy enough to detect if you cannot possibly be running the
typechecker, if there is no `.hhconfig` file, so raise a fatal error in
that case.

Reviewed By: @elgenie

Differential Revision: D1407258
Merge pull request #3319 from danslo/static-linking-bump

bump third-party after recent folly change
Expand assert in refcount-opts

Summary: It's firing in prod and this will give us much more useful stacktrace
files.

Reviewed By: @alexmalyshev

Differential Revision: D1468086
Revert "Fix issues with empty, chunked response"

Summary: This reverts commit 9da3d6adaedc5515f1a7b81a9fc3a6bbd9598afc.

Causing issues with perflab.

Reviewed By: @bertmaher

Differential Revision: D1468100
Move flaky tests to their own directory

Summary: This diff moves all bad tests that are maybe good and maybe pass but have issues running in parallel tests to a new directory called 'flaky'.

Reviewed By: @ptarjan

Differential Revision: D1466144
Remove support for "service threads"

Summary: Apparently hphp used to support running background threads written in
PHP, but we don't use this anymore and it might not really work.

Reviewed By: @mxw

Differential Revision: D1464914
Enable disabled ext_string test

Summary: Something seemed to behave differently in the interpreter vs. the jit
about this at one point, but we must've fixed it.

Reviewed By: @ptarjan

Differential Revision: D1465351
Specify ssl cipher list for curl with OpenSSL only

Summary: Since libcurl can be linked against multiple SSL libraries, it is necessary to use some light instropection when setting CURLOPT_SSL_CIPHER_LIST. This is an issue for some distributions (e.g. Fedora) where libcurl was changed to use Mozilla's NSS library. I'm not sure what cipher list would be desired for NSS, but the default seems adequate for now.

Closes https://github.com/facebook/hhvm/pull/3269

Reviewed By: @sgolemon

Differential Revision: D1455368

Pulled By: @ptarjan
Make generated silverstripe config file php, not hack

Summary: - 'global' isn't allowed in hack
 - it should still be possible to run the frameworks against PHP5

Reviewed By: @JoelMarcey

Differential Revision: D1467755
These are flaking out for me locally

Reviewed By: @swtaarrs

Differential Revision: D1468898
Disable flaky zend test

Reviewed By: @bertmaher