Remove PAM dependency code.
The libpam dependency was brought 3.5 years due to c-client.  As of today,
there's no need neither in HHVM or c-client to link against libpam.
HHVM itself does not depend on boost_regex.
Only third-party/folly depends on libboost_regex, but HHVM has a
dependency that causes a bogus linkage in the final binary.

Sync with Debian patch 09_remove_boost_regex_hhvm.patch from 2.4.1-1.
Disable bogus code for finding and linking against ncurses.
For some very old reason lost in the dawn of time, HHVM imported the
CMake file of Readline from KDE, which had an ncurses dependency. Remove it
from everywhere.

Sync with Debian patch 08_disable_libncurses.patch from 2.4.1-1.
Ignore editor backup files in .gitignore
Merge pull request #2182 from tstarling/patch-1

Ignore editor backup files in .gitignore
docs for hhvm -a, --interactive

Just updating docs with hhvm -a, --interactive information. These are
the docs I read when searched for hhvm REPL for the first time and
didn't find it.

Fixes #1694
Closes #2079
Github Author: Márcio Almada <marcio3wgmail.com>

Reviewed By: @fredemmott

Differential Revision: D1230083
Rename fb_autoload_map to HH\autoload_set_paths

- not FB-only
- very useful
- Renamed to fit in better with php5 autoload functions
- Don't have 'map' in the name given that it takes an array, not an HH\Map

Reviewed By: @ptarjan

Differential Revision: D1229244
Replace unicode characters with corresponding HTML entities in htmlentities

Fixes #1875 and a failing Klein.php test.
Closes #2061
Github Author: Rafe Kettler <rafe.kettlergmail.com>

Reviewed By: @fredemmott

Differential Revision: D1230171
Including ProxyManager in frameworks tracked for zend parity

ProxyManager is a dependency of ZF2 and SF2 that is doing some very
tricky code generation, as well as dealing with unset properties,
serialization, cloning, etc.

It is currently not on par with HHVM, but reflection and core
features of HHVM cause huge fluctuations in test success rate.

I'm already testing the repo against HHVM nightly (allowed failure on travis, for now), and am
tracking compat at Ocramius/ProxyManager#127, but a comparison
view on http://www.hhvm.com/frameworks/ would help me greatly in
identifying/reporting regressions.

Closes #2093
Github Author: Marco Pivetta <ocramiusgmail.com>

Reviewed By: @fredemmott

Differential Revision: D1229979
Allow the Sandbox to work in FastCGI mode

Passing through the FastCGI DOCUMENT_ROOT unmolested, in particular
allowing it to be empty(), is what the Sandbox requires.
Closes #2099
Github Author: Jim Radford <radfordblackbean.org>

Reviewed By: @fredemmott

Differential Revision: D1229971
actually set the session save path

Instead of just setting the Ini value, also set
s_session->m_session_path.

This prevents HHVM from always picking /tmp.

Closes #2075
Github Author: Daniel Sloof <goapsychadelicgmail.com>

Reviewed By: @fredemmott

Differential Revision: D1224022
Bug fix for guard relaxation when refcount opts are disabled

If we relax {SetL, PopC} pairs to not guard on countedness,
then we must run refcount opts to clean up the IncRef/DecRef pair --
or else we might try to access the count field when it's invalid.

Reviewed By: @swtaarrs

Differential Revision: D1229447
Set up control flow options for contbuild control

Reviewed By: @ottoni

Differential Revision: D1229608
PHAR optional parameters

Closes #2055
Closes #2094
Github Author: Marco Pivetta <ocramiusgmail.com>

Reviewed By: @fredemmott

Differential Revision: D1229939
Fix compilation on FreeBSD and OSX from f15d52f

HOST_NAME_MAX is recommended by POSIX, but not required to be defined. 255
is generally a safe number to assume in that case and matches upstream's
behavior.
Closes #2089
Github Author: Chad Horohoe <chadhwikimedia.org>

Reviewed By: @fredemmott

Differential Revision: D1230067
fix (de)serialization incompatibility with multiple sessions

When using named sessions (see session_name), multiple sessions are
stored in a single session file. The serialized data in these sessions
may refer to previous objects, using "r:<reference_id>".

HHVM stores these reference IDs on a session_name basis. Zend PHP
however, keeps using the same reference counter for all sessions it
encounters in a single file. This works fine when either of two systems
is being used, but this may causes session data to be read improperly or
corrupt it when sharing sessions.

This change works in several ways:
- Allow us to dynamically set start/end buffers in VariableUnserializer
  so we can keep using the unserializer while keeping m_refs.
- Implement a keepCount option in VariableSerializer that does nothing
  other than keep the existing reference count, this option is disabled
  by default.
- Move serializer/unserializer out of session iteration scope so that
  we don't lose reference information.

Additionally there is a test demonstration the issue.

Closes #2078.
Closes #2092
Github Author: Daniel Sloof <goapsychadelicgmail.com>

Reviewed By: @fredemmott

Differential Revision: D1230054
Fix precedence for == with DateTimeInterface implementations

Reviewed By: @alexmalyshev

Differential Revision: D1230275
Fix simplifier rules for ConvStrTo{Dbl,Int}

The simplifier was using isNumericWithVal, and then casting the
result to {Int,Dbl}.

PHP5 has functions convert_to_{double,long} and they just call
strtod and strtoll respectively.

Reviewed By: @ottoni

Differential Revision: D1229976
Test type suggestions with namespaces

Just realized I must have never really tried this before.
Thankfully it works. Add a unit test for it.

Reviewed By: @gabelevi

Differential Revision: D1230237
Improve exception support in ext_zend_compat

Exceptions in Zend work by setting EG(exception) and adjusting the
VM opline pointer, and then returning to the C caller as usual.
C code is not exception-safe, and will leak memory or worse if C++
exceptions are allowed to propagate into it.

So:

* Set up try/catch blocks around C++ function calls. When an exception
  occurs, set EG(exception) to something sensible and save the exception
  object for rethrowing after the extension function returns.

* In zend_throw_exception(), just save the object for throwing later and
  return, don't actually throw it.

* Add a separate extension for testing aspects of ext_zend_compat, called
  ezc_test. It is based on ext_skel, and its tests are confirmed to work
  under Zend. The features I want to provide in ext_zend_compat were not
  properly tested by the existing extensions.

* Fix the JIT unwinder to properly interpret exception objects whether
  they are normal exceptions or "dependent" exceptions, i.e. thrown by
  std::rethrow_exception(). Document the GCC code I followed in doing
  this. This allows std::rethrow_exception() to be used in hhvm.

Also:

* Fix the use of default_exception_ce. It wasn't reliably initialised,
  but even if it were, it stores a pointer to request-local memory, so
  a static variable with no __thread was never going to work.

* Fix assertion from zend_call_function() when fcc->object_ptr is not
  initialised. With calling code such is found in Zend's
  call_user_func(), it will just point to uninitialised stack memory.
  Set it to NULL in fcc and fci, like what the Zend code does for
  global functions. Also document some pre-existing incompatibilities
  with the Zend interface.

* Pop the ZendExecutionStack even if an exception was thrown, otherwise
  memory will leak.

Fixes facebook/hhvm#1986

Reviewed By: @ptarjan

Differential Revision: D1220351