Fix thread stack limits on base thread in cygwin

Summary: Because of the nature of the pthreads layer, the attr passed to pthread_attr_getstack MUST be the one passed through pthread_create OR it needs to be fetched with the gnu extension pthread_getattr_np

Reviewed By: @JoelMarcey

Differential Revision: D1501623
typechecker: class_meth can use self::class and static::class

Summary: Referring to self::class and static::class is unambiguous in the
 context of `class_meth`. `self::class` is equivalent to the behavior
 with `__CLASS__`, whereas `static::class` is new functionality that
 allows `class_meth` to support dispatch to late-bound static methods.

Reviewed By: @jwatzman

Differential Revision: D1500010
typechecker: detect abstract parent:: calls

Summary: `parent::foo()` invokes a specific method and not a
 late-bound one; it's thus non-sensical for that method to be
 `abstract`.

Reviewed By: @jwatzman

Differential Revision: D1500136
Also move .skipif files and test against repo mode

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

Reviewed By: @fredemmott

Differential Revision: D1496026

Pulled By: svcscm
Extended and further refactored debug hooks to abstract hphpd features

Summary: This diff is necessary to implement breakpoints and flow control for xdebug.
It is again a large diff, so I apologize for that, but I did split this up
from the next two diffs I am going to send out.

Before, setting breakpoints was possible through the debug hooks, but they
were extremely limited- you could only provide offsets. hphpd implements
a ton of logic in order to implement its different types of exceptions within
this framework. The most difficult type is the line breakpoint as lines span
multiple opcodes and we only want to break on them once.

Now, function entry, function exit, and line breakpoints can be added directly
through `phpAddBreakPointFuncEntry`, `phpAddBreakPointFuncExit`, and
`phpAddBreakPointLine`. The implementation of line breakpoints, though much
simplified, follows the same approach as hphpd.

Ultimately hphpd's breakpoints could be refactored to use this approach, but
for now I've just exposed the approach for other debuggers (namely xdebug) as
I don't think refactoring hphpd would be the best use of time right now.

Reviewed By: @alexmalyshev

Differential Revision: D1494622
Fix too many arguments error to match PHP

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

Reviewed By: @ptarjan

Differential Revision: D1500290

Pulled By: svcscm
don't statically link libgcc/libstdc++ by default on OSX

Summary: A previous commit, 552b409dbc71cc9e8a0487fbd6e915f9d7330598, caused us
to always statically link for the sake of portability. However, there
currently exists a bug in (homebrew?) gcc which is causing exceptions
thrown by the application to call abort instead of properly unwinding
and allowing the exception to be caught. An example can be found here:
https://bugs.busybox.net/show_bug.cgi?id=7208

HHVM uses throw/catch in Repo::schemaExists to determine if a table
exists. This caused a runtime crash on OSX.

Ideally we'll be moving to clang on OSX in the near future anyway, but
if, for whatever reason, we want to use gcc *and* statically link at
some point, we can use the recently added cmake option STATIC_CXX_LIB
to do so.
Closes https://github.com/facebook/hhvm/pull/3480

Reviewed By: @JoelMarcey

Differential Revision: D1500299

Pulled By: @sgolemon
Fix information leak in hash_equals() implementation

Summary: Existing code had branches which could potentially be
exploited to determine $known_len.  Stick to always
doing the same work regardless of $known_len.

Note that this depends on the compilation of this:

  if (ki < known_limit) {
    ++ki;
  }

Turning into:

  CMP (ki), (known_limit)
  ADC (ki), 0

Since our BC->IR->ASM loop doesn't do that,
I moved it back to C++ where we get better
compilation.

Reviewed By: @apage43

Differential Revision: D1490528
trim values in json_decode for null, true and false

Summary: JSON RFC says to consider as whitespace: space, tab, LF, CR
Closes https://github.com/facebook/hhvm/pull/3478

Reviewed By: @fredemmott

Differential Revision: D1500291

Pulled By: svcscm
Fix mcrypt_create_iv(..., MCRYPT_RAND) to auto-seed RNG

Summary: Without seeding the random number generator,
we'll always get the same IV, and that reduces the security
of this function.

Fortunately, f_rand() has all of that logic for auto-seeding
and selection of a suitable initial seed built-in.

Realistically, using MCRYPT_RAND should be deprecated.
I'm going to wait on PHP Internals to make a decision on
https://wiki.php.net/rfc/deprecate_mcrypt_rand
before adding that warning however, so that our test suite
remains consistent.

Credit: Theodore R. Smith of PHP Experts, Inc. <theodorephpexperts.pro>

Closes #3496

Reviewed By: @ptarjan

Differential Revision: D1502435
Print inline frames in `walkstk`

Summary: Now I don't have to type `bt` anymore.

Reviewed By: @edwinsmith

Differential Revision: D1502349
Trim the next file name

Summary: This removes trailing null characters, meaning the `file_put_contents` in `extractAllTo` doesn't error from a path with a null character in it which happened when trying to extract a file with a name over 100 characters long.

Also matches the behaviour of a non-link file where the filename gets trimmed when read from the header.
Closes https://github.com/facebook/hhvm/pull/3408

Reviewed By: @ptarjan

Differential Revision: D1488803

Pulled By: svcscm
apc_add(Array) returns an array of errors

Summary: That array is formed `key=>error number`. Currently there is only -1 for an insertion error
Closes https://github.com/facebook/hhvm/pull/3423

Reviewed By: @ptarjan

Differential Revision: D1488962

Pulled By: svcscm
fix Redis lrem can remove type is string or float

Summary: Fix Redis lrem don't remove in addition to Long value,

Specific content see:

https://github.com/facebook/hhvm/issues/3452
Closes https://github.com/facebook/hhvm/pull/3453

Reviewed By: @ptarjan

Differential Revision: D1494809

Pulled By: svcscm
Dont use SQLite 3.8.4

Summary: Extended the blacklist of 3.8.5 to include all 3.8+ versions. This fixes the same issue as hhvm/hhvm-third-party#4 (if your system SQLite version is 3.8.4).
Closes https://github.com/facebook/hhvm/pull/3473

Reviewed By: @ptarjan

Differential Revision: D1500289

Pulled By: svcscm
Updated cakephp3 to 3.0.0-alpha2 in the framework tests

Summary: We have a higher test pass rate of 98.56% now.
Closes https://github.com/facebook/hhvm/pull/3501

Reviewed By: @ptarjan

Differential Revision: D1502584

Pulled By: svcscm
Re-record zf2 tests and flakey list a file

Summary: Additional follow up to #3454 in addition to #3455.
Closes https://github.com/facebook/hhvm/pull/3489

Reviewed By: @ptarjan

Differential Revision: D1502579

Pulled By: svcscm
Added factory muffin to the framework tests

Summary: Note that the tests don't run correctly on the current 2.0.x tag. They require changes that will land in the 2.1.0 release.
Closes https://github.com/facebook/hhvm/pull/3500

Reviewed By: @ptarjan

Differential Revision: D1502582

Pulled By: svcscm
Move debugger from IDL to HNI

Summary: Part of #1480.

This moves the functions from `debugger.idl.json` to HNI.
Closes https://github.com/facebook/hhvm/pull/3491

Reviewed By: @ptarjan

Differential Revision: D1502583

Pulled By: svcscm
Never call TranslatePath() on filepaths beginning with a wrapper

Summary: When called on a string preceding a wrapper the wrapper turns into an absolute path.
Resulting in file not found most likely
Closes https://github.com/facebook/hhvm/pull/3503

Reviewed By: @ptarjan

Differential Revision: D1502585

Pulled By: svcscm