SplFileObject->fgetc() properly increases linenumber

Summary: That zendtest describes the problem pretty well.
Closes #3052

Reviewed By: @ptarjan

Differential Revision: D1408180

Pulled By: @JoelMarcey
The notice in the mysqli::error_list test doesn't occur with the test runner

Summary: Remove it

Reviewed By: @ptarjan

Differential Revision: D1406141
class_parents/class_implements raise a warning if class doesnt exist

Summary: Closes #3057

Reviewed By: @ptarjan

Differential Revision: D1409003

Pulled By: @JoelMarcey
Fix isset-related behaviour for ArrayObject subclasses

Summary: Unlike most objects, using isset on an ArrayObject will return false
if the element is null. However, `offsetExists` will return true in
this case, so we need to special case ArrayObject.

Commit 31104c56 introduced this special case handling, however it
would cause unexpected infinite recursion if `offsetGet` was
overridden in a child class and that child class used an expression
of the form `isset($this[$offset])`. Users were not expecting
`offsetGet` to be called as the result of an `isset` expression.

This commit fixes the behaviour by calling the `offsetGet` method
from the `ArrayObject` class, instead of the `offsetGet` method on
the supplied object.

Fixes #2871
Fixes #2495
Closes #2986

Reviewed By: ptarjan, jdelong

Differential Revision: D1397482

Pulled By: @JoelMarcey
refactor ext_hotprofiler.cpp into new file ext_hotprofiler.h

Summary: Following existing coding conventions, split out a .h file from ext_hotprofiler.cpp.  In this way, 3rd party profilers can be written and loaded as DSOs.
Closes #3027

Reviewed By: @ptarjan

Differential Revision: D1401272

Pulled By: @JoelMarcey
move CatchInfo from ir.h to code-gen.h

Reviewed By: @bertmaher

Differential Revision: D1408467
EZC: Fix copying of ProxyArray

Summary: 342b1193 introduced several bugs into ProxyArray::Copy and the handling
of "copy" parameters in handlers. I did not realise that Copy() gives a
refcount of zero whereas Make() gives a refcount of 1, and so I
introduced a lot of different ways to get invalid refcounts out of EZC.

* Revert the change to ProxyArray::Copy()
* When a handler is called with copy=true, take this as an opportunity
  to deproxy the array, since the EZC layer itself has no such calls.
  Prior to 342b1193, these handlers just had assert(!copy).
* Revert the change to the first half of ProxyArray::PlusEq()
* In zBoxAndProxy(), incref the result of copy() before decrefing the
  source, to avoid releasing the ArrayData when copy() returns the same
  pointer instead of making a copy. A comment array-data.cpp advises
  that this is possible.
* Added an assert to ProxyArray::Make() which previously failed.
* Added a test case which previously failed.
Closes #3049

Reviewed By: @ptarjan

Differential Revision: D1407639

Pulled By: @JoelMarcey
Update gdb/hhvm.py for recent ProxyArray layout change

Summary: Closes #3050

Reviewed By: @ptarjan

Differential Revision: D1407641

Pulled By: @JoelMarcey
collections: Vector::addAllKeysOf

Summary: ... forgot to add this method when adding Set::addAllKeysOf.

Reviewed By: @billf

Differential Revision: D1409650
Remove unused "Cleanup" shutdown function type

Reviewed By: jan, smith

Differential Revision: D1397106
Add a few try/catch blocks in SCOPE_EXITs in the runtime

Summary: Audited all of them to see if any could throw.  Mostly we're doing it
right.  They must always be nothrow because they are implemented as
destructors.

Reviewed By: @jano

Differential Revision: D1397107
Remove some old options (ThrowBadTypeExceptions, ThrowMissingArguments, etc)

Summary: This is apparently an old hphpc thing that deviated from php behavior
(presumably for performance?  Maybe it was part of HardTypeHints?).  Nothing
sets them to true anywhere, and it doesn't really control all the
warnings/exceptions one would expect anymore, so let's delete them.

Reviewed By: @alexmalyshev

Differential Revision: D1401231
Remove InjectedStackTrace runtime option

Summary: Legacy, and always set to true.

Reviewed By: @alexmalyshev

Differential Revision: D1401800
Remove ServerStackTrace runtime option

Summary: Unused.

Reviewed By: @bertmaher

Differential Revision: D1401845
Revert "Fixed casting Closure to Array"

Summary: It was causing a flib test to fail with infinite recursion, but this
wasn't being reported by sandcastle because of a bug in how we reported that
error (being fixed soon).

Reviewed By: @bertmaher

Differential Revision: D1410241
Reduce the number of exception types

Summary: It makes it too hard understand how we handle exceptions.  (Take a
look at handle_exception_helper in program-functions.cpp.)

Some notes:

  - Whenever we constructed a FatalErrorException from ExecutionContext's
    handleError, we apparently computed an extra PHP stack trace from the
    default ExtendedException constructor, and then threw it away.

  - m_handled was unused in Exception.  m_what is weird but I'm leaving it for
    now (it is a bit odd to add a newline character).

  - raise_error's ternary about whether to throw or not if the user error
    handler recovered had no effects, because the error handler wasn't even
    invoked there.  (We don't invoke the error handler on a fatal until after
    the entire eval stack is torn down.)

  - ExitException::ExitCode is a static member, shared across the request
    threads.  This means the exit callback might sometimes get incorrect exit
    codes in server mode if other request threads are concurrently doing Exit
    opcodes.  This looks like it was a hack for CLI mode: because it's hard to
    communicate anything useful to callers of hphp_invoke.  (I will try to make
    that fixable later.)

Stuff for later:

  - ParseTimeFatalException and AnalysisTimeFatalException probably have no
    reason to derive from Exception, but I'm not sorting that out yet.

  - FatalErrorException, ExtendedException, and Exception probably should all
    be combined into one class, but it requires sorting out 3 remaining
    subclasses (probably an enum is better than our rethrowing stuff).

  - We should stop throwing Object for user exceptions and have another,
    independent, std::exception subclass for that.

Reviewed By: @ptarjan

Differential Revision: D1404996
Remove defaulted args in hphp_invoke and hphp_invoke_simple

Summary: Necessary before possibly modifying hphp_invoke.  It's only slightly
less dangerous after this diff.

Reviewed By: @elgenie

Differential Revision: D1405000
Refactor running psp hooks so it's not part of hphp_context_exit

Summary: Rather than sending a bool into the function---I want to make it
easier to deal with PSP as a separate step so we can possibly change whether it
runs after a request ends with a fatal.  The final defaulted arg was also only
for the PSP code, and the shutdown arg was always passed true.  I am changing
the RPCRequestHandler not to call the post-psp debugger hook because I think it
was probably actually not intentionally doing so (since it doesn't run psp).

Also removed the ExecutionContext* argument: hphp_session_exit seems to be
willing to assume we're doing it to g_context, and I think we can afford the
extra load from TLS.

Reviewed By: @jano

Differential Revision: D1405002
Fix signature compatibility checks for __construct

Summary: Before this diff, HHVM would only perform signature compat checks for
__construct if an implemented interface contained a __construct decl.
This diff fixes HHVM to also perform signature compat checks for
__construct if an abstract parent class contains an abstract __construct
decl.

Reviewed By: eletuchy, ptarjan

Differential Revision: D1409958
argument unpacking: adding FCallUnpack

Summary: Basic functionality for Implementing https://wiki.php.net/rfc/argument_unpacking

 Limitations:
  - no traversal of non-containers (that needs an FPassUnpack)
  - no implementation of multiple calls
  - no FCallD equivalent for determining function exactly
  - no splat calls to functions that have ref params

Reviewed By: andrewparoski, ptarjan

Differential Revision: D1281749