Fix incompatible interface implementation error message

This one was a mess. We had a bunch of `Pos.none` lying around,
leading to an incredibly bad error message for the new test case in this
diff (distilled from a case that @KendallHopkins actually hit in real
code). This diff tries to give better witnesses in a lot of cases,
particularly fixing the error message in this case. It still isn't a
**great** error, but it at least is workable now, pointing to the
problem instead of into the ether :)

Reviewed By: @pikatchu

Differential Revision: D1252761
Builtin classes are always persistent

While debugging other issues, I noticed that we were
reading the Class* for Exception from the rds, even though
the handle was clearly a persistent handle.

Found that we were guarding on RepoAuthoritative - but thats
clearly too late (if the Class isn't persistent, for whatever
reason, we should not have allocated a persistent handle).

Reviewed By: @jdelong

Differential Revision: D1253986
variadics: add ellipsis to parser

... and parse variadics as params. Part 1 of implementing https://wiki.php.net/rfc/variadics for HHVM

Reviewed By: @jdelong

Differential Revision: D1225065
use PackedArrayInit in f_array_map

... pretty straight-forward.

Reviewed By: @edwinsmith

Differential Revision: D1253631
Implement ReflectionClass::isCloneable

hhvm was missing the method `isCloneable` on `ReflectionClass`, This diff implements it.

Closes #1596

Reviewed By: @fredemmott

Differential Revision: D1253045
Cleanup in array-iterator helpers (mostly dead code removal)

iter_next wasn't used anymore, and iter_next_key is only
instantiated when withRef is true.  getContainerIter was also dead.
Removed some unnecessary casts in the function pointer table, and the
table didn't need to be exported in the header.  While here I also
figured we can directly send the iterNextKObject case to
iter_next_cold instead of to a function that just jumps to it
(probably not a common enough case to matter).

Reviewed By: @dariorussi

Differential Revision: D1248545
Allow enabling the stacktrace profiler from the admin server

Useful if you want to get information about things ignoring
the stuff happening during load apc.

Reviewed By: @edwinsmith

Differential Revision: D1236019
Audit all ArrayInit call sites, change them to specify expected shape

I'm going to change ArrayInit to start with kMixedKind
instead of kPackedKind, since almost all callsites are going to
immediately insert a string.  Many packedToMixed calls seem to result
from this stuff in extension code right now, and this will also let us
devirtualize the calls in ArrayInit if we want.  The ones that weren't
actually Map/Struct-like I mostly ported to PackedArrayInit, except a
few cases that have mixed or integer keys, which I just used a
type-alias to flag as Mixed for now.

Reviewed By: @bertmaher

Differential Revision: D1240419
Unit test for prediction optimizer

This one's pretty simple, so I think we really only need this one test.
No refactoring was needed either. Go us!

Reviewed By: @swtaarrs

Differential Revision: D1254539
Fix assertRefCount checks

It was doing an unsigned compare where it needed
a signed one, which basically allowed through any refcount that
was not in the range -126 to 0:

        0x13800052: cmp dword ptr [r14+0xc], 0xffffff81
        0x13800057: jbe 0x13800065
        0x13800059: cmp dword ptr [r14+0xc], 0x3fffffff
        0x13800061: jbe 0x13800065
        0x13800063: ud2
        0x13800065: inc dword ptr [r14+0xc]

That first jbe should be a jle

Reviewed By: @dariorussi

Differential Revision: D1254021
Guard against integer overflow on HHVM string functions

Introduce a overflow-checking function to fix the following functions:
  - escapeshellarg
  - escapeshellcmd
  - urlencode
  - quoted_printable_encode (pulled other changes from upstream)

Reviewed By: @bertmaher

Differential Revision: D1250778
Remove deprecated slice() and kvzip() methods

Reviewed By: @elgenie

Differential Revision: D1253752
Do not ignore filtered result in php_filter_validate_url

`php_filter_validate_url` ignored the result of `php_filter_url`, which made several cases of URL validation fail.

Fixes #2199 and #2070

Reviewed By: @ptarjan

Differential Revision: D1250134
interpOutputType() wasn't emitting a CheckStk

It was just returning inst.outPred, which would set the predicted type
as the type param for the InterpOne, but it'd never be checked.

Reviewed By: @ottoni

Differential Revision: D1254308
Implement CallbackFilterIterator

This implements CallbackFilterIterator. It also makes the basic tests pass. Moved the test from zend/bad to zend/good.

The 002 tests in the folder diff because of the output messages from the compiler versus PHP's. However, they appear to be giving the right failures. Wasn't sure whether the group ignores those, patches up the expect file, corrects the messages from the compiler, etc.
Closes #2244
Closes #1715

Reviewed By: @fredemmott

Differential Revision: D1249528

Pulled By: @ptarjan
Treat "Parse error" (E_PARSE) the same as a "Fatal error".

("Fixes" 10 "bad" tests.)
Closes #2243

Reviewed By: @fredemmott

Differential Revision: D1253829

Pulled By: @ptarjan
EZC: Match BEGIN_EXTERN_C() with END_EXTERN_C() instead of a bare brace.

Helps if you want to make BEGIN_EXTERN_C() a no-op.
Closes #2273

Reviewed By: @fredemmott

Differential Revision: D1253819

Pulled By: @ptarjan
Move test for file_put_contents

Refs #2251

Reviewed By: @fredemmott

Differential Revision: D1253824

Pulled By: @ptarjan
Fix second-pass CSE

During reoptimize we remove instructions from their block
before optimizing and re-appending them, so it always fails when we
CSE checks to see if an intruction's block is dominated by an
available expression.

The simplest solution seemed to be passing in the instruction's source
block along with the dominator list.

Reviewed By: @swtaarrs

Differential Revision: D1250860
Unbreak the Framework Test Runner

Now that HHVM is enforcing return types (yay!), getFrameworkInfo() was a culprit. It was returning ?string, but the blacklists are an array, for example. So return mixed.

Reviewed By: @ptarjan

Differential Revision: D1255765