fix register_shutdown in session_set_save_handler

Do not register automatically session shutdown function when
session_set_save_handler called in PHP <5.4 style.
PHP Manual: Note we additionally register the shutdown function
session_write_close() using register_shutdown_function() under PHP less
than 5.4.0. This is generally advised when registering objects as
session save handlers under PHP less than 5.4.0.

Closes #1001

Differential Revision: D949388
Fix nemo warnings for 'resource' and 'callable' typehints

Noticed these showing up because some resource type hints
were added to systemlib.php

Differential Revision: D951170
Abstract "index to byte" computation out of LdElem and StElem instructions

Moved the shift to compute the position size in bytes out of the instruction LdElem and StElem. Leads to better optimizations

Differential Revision: D949770
We need to stop boost from trying to guess command line options

Currently boost is guessing at command line options. We need to stop this so we can use --debug for phpunit and not get "Error in command line: option '--debug' is ambiguous and matches" errors from boost.

Differential Revision: D951632
Handle exception messages which are std::string, too

Add support for Exception(std::string)

Differential Revision: D950763
Add counters in hhvm to track # of requests killed due to timeout or exceed memory

Right now these manifest themselves just as fatal. I think it then gets pumped
to log view. We don't do a good job monitoring these. Add counters so we can
track them better.

Differential Revision: D949107
protect #define with an #ifndef

Getting strange compiler error and thus protecteing definition in header

Differential Revision: D951881
Update NEWS

Differential Revision: D949307
Fix bugs with invokeFunc() and invokeFuncFew(), and other cleanup

This diff fixes some bugs with invokeFunc() and invokeFuncFew(), it removes
some dead code, and it converts more places to use cellDup() instead of
tvDup().

invokeFunc() had a bug where the VM stack did not get cleaned up properly
when a warning is raised and the user error handler threw an exception.
This diff adds a catch clause that will perform the appropriate cleanup and
then rethrow the exception.

invokeFuncFew() had a bug where in some cases it would pass a parameter by
reference when the callee required that the parameter be passed by value.
This was happening because TypedValues that were KindOfRef would get copied
onto the VM stack using operator=, and nothing was checking whether the
callee required the parameter to be passed by value. This diff fixes the
issue by reworking invokeFuncFew() and callers of invokeFuncFew().

Differential Revision: D949251
easy: adding T_TRAIT and T_TRAIT_C constants

The constants were undefined, but are necessary for parity
with Zend and for the internal consistency of `token_get_all` and
`token_name`.

Differential Revision: D952502
Fix HHVM command line parsing

At present, there are some corner cases where hhvm doesn't parse command
line arguments properly. For example, doing "hhvm foo.php -u" causes a
'required argument missing' error even though "-u" is an argument intended
for the PHP application.

This diff fixes the problem by doing a manual pass over the args ahead of
time before invoking the boost command line parser. This seems to be the
only reliable way to prevent the boost command line parser from choking on
args intended for the PHP application.

Differential Revision: D952180
Remove the EnableMemoryManager runtime option

Does anyone want this?

Differential Revision: D932380
Fixed bug #53319

Fixed bug #53319 (strip_tags() may strip '<br />' incorrectly)

Differential Revision: D951187
Add DequeuePacked and PrependPacked

We only handle a few easy cases for these, but since these
operations renumber and compact elements on Mixed arrays,
there's no point in escalating from packed to mixed; we might
as well do memmove and leave the existing 0..N numbering.

Differential Revision: D945517
Don't try to send data after the response has already been sent

Prevent memory corruption when a fatal/exception during PSP
triggers a flush() after data has already been sent and the transport
is in an invalid state.

Differential Revision: D953102
Update NEWS for Kimchi release

Differential Revision: D952964
Remove m_sendEnded assertion in LibEventTransport::sendImpl

We're exiting early in this case anyways.

Differential Revision: D953174
Fix a few issues with type-inference/optimization and CodeErrors

We were doing type inference on Native functions, which ended
up throwing away the return type, resulting in incorrect type annotations,
and bogus CodeError.js warnings.

Similarly, Native methods were treated as abstract (since they have no body),
resulting in CodeError.js warnings if you derived from classes containing
Native methods.

Differential Revision: D951860
Let ext_zend_compat define its own PACKAGE_VERSION
Only build ext_zend_compat (and related extensions) on linux (for now)