Fixed casting Closure to Array

Summary: When casting an object of type Closure to an Array, the result should be an array containing the closure.
This diff also fixes incorrect var_dump output for Closure to make the test pass.

Fixes #2918

Reviewed By: @ptarjan

Differential Revision: D1391371
Fix /stop when bind fails, redux

Summary: Third attempt at fixing this problem.  The IP and AdminPassword are missing in the stop url.  This causes a 60 second delay starting a new HHVM as it waits to kill based on the pidfile.

Added a callback class 'ServerEventListener' which gets a call when a server is about to close the listening socket.  HttpServer uses this callback to remove the pidfile.  The timing of removing the pidfile is sensitive as we have to remove it before a new HHVM thinks it created it.

Fixing this now in the context of a mysterious startup crash that happens when devs get impatient and restart the server multiple times. t4483583

Reviewed By: @bertmaher

Differential Revision: D1377159
Unclown mustache test

Summary: Should be reliable with per-run tempdirs

Reviewed By: @JoelMarcey

Differential Revision: D1398401
Change order of wait handle processing from FIFO to LIFO

Summary: Process most recently woken up wait handles first.

Reviewed By: @billf

Differential Revision: D1394032
Implemented xdebug_call_function

Summary: This diff implements the xdebug function xdebug_call_function.
If function g calls function f and function f calls xdebug_call_function,
the name "g" is returned.

Reviewed By: @sgolemon

Differential Revision: D1388555
Remove unused util/pool.h

Reviewed By: @ptarjan

Differential Revision: D1396961
ArrayIterator->current() is supposed to return null after end of array

Summary: current() return false on failure and key() returns null because who needs to follow any rules?
Closes #2997

Reviewed By: @ptarjan

Differential Revision: D1397185

Pulled By: @JoelMarcey
Include types of locals in autocomplete results

Summary: We're completing locals right now during naming and we don't have types available there yet.
But, in typing, all we have is idents and types.

Approach:
-When we hit the old autocomplete point in naming, store a map of variable names to idents and the current position.
-When we hit an Lvar at that same position in typing, use that map to get the types of everything.

Reviewed By: @pikatchu

Differential Revision: D1385988
check parent::__construct combination with trait requirements

Summary: With trait requirements, we can now make ensure that an
 ##__construct## in a trait calls the parent constructor of its
 ##require extends## class(es).

 Since we do separate checks for ## __construct ##, it makes sense to
 make sure that we've covered the case where a ## __construct ## is
 present in a class that uses a trait and provides a ##__construct##
 as well.

Reviewed By: @jwatzman

Differential Revision: D1396751
Fix Memcache::get($keys) when $keys is an array

Summary: Without this patch, the result of the test is:

array(2) {
  ["abcdef1"]=>
  string(13) "value:abcdef1"
  ["abcdef13"]=>
  string(14) "value:abcdef13"
}

This fix is needed for drupal (with the memcache module).
Closes #2994

Reviewed By: @ptarjan

Differential Revision: D1397189

Pulled By: @JoelMarcey
Disable test/slow/ext_xdebug/xdebug/peak_memory_usage.php

Summary: It's been flaking out on various diffs.

Reviewed By: @alexmalyshev

Differential Revision: D1398776
Converting ArrayObjcets to an array was not working correctly when the STD_PROP_LIST flag was set

Summary: The STD_PROP_LIST flag for array objects should treat properties of the array object as if they are the storage of the class. When we were converting to an array the internal storage array was still being copied. This also a problem with json_encoding where the properties were not being encoded. Fixes #2139

Reviewed By: @ptarjan

Differential Revision: D1382324
Separate flakey from clowny tests

Summary: - add --flakey option to run them anyway
 - make it so you don't need to blow away framework_downloads/WHATEVER every time you remove something from the flakeylist/clownlist/blacklist or add --flakey

The idea is that we will still run flakey tests for the charts on hhvm.com/frameworks/ , but we won't include them in our commit-blocking test runs.

Reviewed By: @JoelMarcey

Differential Revision: D1398512
kill clock_settime

Summary: no callers

Reviewed By: @fredemmott

Differential Revision: D1218781
Clownlist tests that delete $_ENV['TMPDIR']

Summary: sadpanda

- also make it easier to debug when this happens
- re-record - error happens on my devserver without these changes :(

Reviewed By: @ptarjan

Differential Revision: D1398986
Make FuncEmitter nicer

Summary: Get rid of getters and setters where possible, and make it clear which
properties are used in a POD-like way, and which represent state that's
somehow managed by FuncEmitter methods.

This is not completely satisfying, but it's a pretty good stopping point
on the way to a readable all-the-things-loader---i.e., I'm not going to
touch it anymore.

Reviewed By: @alexmalyshev

Differential Revision: D1390885
Introduce async generators

Summary: Initial implementation of async generators.

Reviewed By: @billf

Differential Revision: D1382845
Fixed bug where xdebug_memory_usage could return a negative value when using jemalloc

Summary: This diff fixes an edge case in xdebug_memory_usage where a negative value could
be returned if jemalloc is being used. As explained in ext_std_options.cpp:831:

"Since we don't always alloc and dealloc a shared structure from the same
thread it is possible that this can go negative when we are tracking
jemalloc stats"

This should stop the xdebug/peak_memory_usage.php test from being flaky.

Reviewed By: @ptarjan

Differential Revision: D1397065
regrouping all the errors in the same file.

Summary: All the logic to build an error is now in errors.ml.
The type of an error is abstract (cf errors.mli), to make sure that it stays that way.

Reviewed By: jwatzman, eletuchy

Differential Revision: D1390136
Added xdebug code coverage

Summary: So this is a large diff, I apoligize for that in advance. However, most of the
code is taken from D1220726 and most lines come from the added tests.

This diff adds the xdebug functions related to code coverage. You can
view these functions here http://xdebug.org/docs/code_coverage.
Code coverage is started with xdebug_start_code_coverage and stopped
with xdebug_stop_code_coverage. xdebug_get_code_coverage returns an
array first indexed by filename, then by line number, where the value
is the number of times that line was executed.

Depends on D1390958.

Reviewed By: @ptarjan

Differential Revision: D1392774