Fix parenthesized function hint check

Summary: We have to use error_at instead of calling the Errors module
directly, because error_at allows the parser to revert these errors and
backtrack if necessary.

Ideally, we'd support multiple error codes through error_at, but that
should probably be in a refactoring commit of its own.

Reviewed By: @jwatzman

Differential Revision: D1528293
JSON encode now detects recursion on array in serializable objects

Summary: fixes #3483
The cause of the problem is that there is no recursion detection for serializable objects, which can lead to a stack overflow.

Also, moved bad zend test bug61978 to good.

Reviewed By: @ptarjan

Differential Revision: D1522715
Remove FramePtr dests from {Assert,Check,Guard,SideExitGuard}Loc.

Summary: They are no longer needed, as IRBuilder tracks type sources by its
GuardConstraints object.

Reviewed By: @ottoni, @swtaarrs

Differential Revision: D1518873
Add a screaming header describing provenance to automatically generated C++ source files.

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

Reviewed By: @sgolemon

Differential Revision: D1527969
Implement error handler function's context parameter

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

Reviewed By: @ptarjan

Differential Revision: D1492036

Pulled By: @sgolemon
Add Extension::moduleEnabled() hook

Summary: This takes the special cases for
apc, apache, and xhp out of extension.cpp
and allows EZC extensions to be compiled in,
but not actually enabled.

Reviewed By: @ptarjan

Differential Revision: D1528920
Implemented xdebug remote commands

Summary: This diff implements the following remote commands:
* stop, detach
* stack_get, stack_depth
* context_names, typemap_get
* source
* stdout, stderr
* xcmd_profiler_name_get

The description of each is right above the implementation, so I won't go
into detail here.

These commands were all very simple to implement, which is why they are done
in this diff. The rest are incoming.

Other changes of note:
* XDebugCommand construction is no longer const. This was limiting the use of
  `XDebugCommand::handleImpl` and wasn't really necessary.
* `XDebugCommand::handleImpl` doesn't return a bool any longer, as it was the
  same result for almost all commands

Reviewed By: @ptarjan

Differential Revision: D1511176
Kill some dead emitter code

Reviewed By: @edwinsmith

Differential Revision: D1529862
Implemented xdebug breakpoint commands and slightly refactored xdebug xml api

Summary: This diff implements the following remote debugging commands:
* breakpoint_get
* breakpoint_list
* breakpoint_remove
* breakpoint_update

The descriptions are self-explanatory, but they are also written above each
implementation.

This diff was intended to implement the xdebug breakpoint commands, but I got
fed up with dealing with the xdebug xml code and so I slightly refactored that
as well. The changes go a long way to making it better, but are definitely not
enough in the long run.

Reviewed By: @ptarjan

Differential Revision: D1512977
when decoding numeric HTML entities, check if they're a number

Summary: According to php-src, strtol is pretty lenient with whitespace and other
non-numeric characters at the start of a string. Add the same checks
that exist there before attempting to process the numeric entity.

See:
https://github.com/php/php-src/blob/1e3e9e0bbbe073db4a32627e67e8f5d838852eaf/ext/standard/html.c#L802
Closes https://github.com/facebook/hhvm/pull/3630

Reviewed By: @JoelMarcey

Differential Revision: D1529806
Fix a race initializing static properties

Reviewed By: @swtaarrs

Differential Revision: D1529994
Fix dwarf_producer_init check

Summary: dwarf_producer_init takes 10 arguments, but the checking code only
supplied 5, meaning that the `const char*` check would always fail,
producing the wrong information and preventing compilation.
Closes https://github.com/facebook/hhvm/pull/3636

Reviewed By: @JoelMarcey

Differential Revision: D1530061
Let vasm use all the registers

Summary: Expand the unreserved registers for vasm (when compiling a whole
IRUnit, but not when compiling snippets of code via Vauto) to include
all usable registers (everything except rbx,r12,rsp,rbp).

Add an "args" mask to all the call opcodes to indicate which registers
are used (as register arguments) to the call. vasm-xls marks these used
by the call; prior to the call, there are copies into these registers,
so they are live from the copy to the call.

Reviewed By: @swtaarrs

Differential Revision: D1527672
Fix bogus type assertions from nested arrays

Summary: In the new test case hhbbc correctly figured out that after
the first [], we had an array all of whose keys were intergers,
and all of whose values were array(55). For the second [] it knew
that the base was either null, or array(55). As a result, it gave up
on trying to update the known value of the array - but didn't discard
what it already knew.

When we iterated the array, it then thought the value had to be null, or
array(55). We eliminate the null by the if/continue, and so it asserted
that it was an array of one element (it doesn't bother to assert the types).

There are two fixes. The first was to improve the type of the base. If the
base of an array is known to be null or array(55), and we push somthing onto
it, we should promote it to empty|array(55), and then do the push (the existing
code converted it to null|empty|array(55)). The second was to drop any
specialized information from the base type when we don't know how to update it.

Reviewed By: @edwinsmith

Differential Revision: D1529980
Fix APC test giving more time between add and fetch to make sure expiration takes place

Summary: Make sure there is enough time for expiration to take place

Reviewed By: @bertmaher

Differential Revision: D1508686
Update NEWS for "Snoop Dogg"

Reviewed By: @markw65

Differential Revision: D1530250
Rename namespace ARM and X64 to arm and x64

Summary: This is purely for aesthetics and seemed good in the wake
of s/JIT/jit/. Not planning any more churn after this.

Reviewed By: @markw65

Differential Revision: D1519347
CMake: use bundled PCRE if system PCRE doesn't jit

Summary: PCRE comes with its own CMakeLists.txt, fortunately, so all we have to
do is run it.

Caution: I have very little idea what I'm doing when it comes to CMake
-- there's a lot of hidden magic going on -- but I think this is some
approximation of correct.

Reviewed By: @ptarjan

Differential Revision: D1523103
Implemented important remote debugging commands and other fixes necessary for phpstorm

Summary: @jlreyes: This diff gets phpstorm working with xdebug. Everything should work but I haven't had time to cleanup
or write tests.
@paulbiss: added test coverage, fixed broken tests, implemented symbol parsing

Reviewed By: @ptarjan

Differential Revision: D1515484
Fix crash due to hash collisions in POST data

Summary: Too many hash collisions in the POST data resulted in
a warnUnbalanced fatal, which was only caught by the "last resort"
catch in HttpRequestHandler::handleRequest.

This revealed a few bugs: sourceRootInfo and reqURI both contain
smart allocated Strings, but their destructors run after
hphp_session_exit() has destroyed the memory manager. Its not
clear to me why this isn't a problem when we don't fatal, but
I fixed it by splitting handleRequest to ensure the
destructors are called earlier.

This still left us with a problem where we didn't correctly
close the connection, so I fixed that too.

Reviewed By: @dariorussi

Differential Revision: D1496904