Do a deeper check for minimum num args in HNI calls

Signatures like the following were confusing
the existing min args checker because it assumed once
you saw an arg with a default value, all further args
would have one.  That is however, obviously untrue.

  function foo(string $bar, array $baz = null,
               int $bong, float $bang = 0.0);

The old algo would consider this to require at least 1 arg.
The new algo considers this to require at least 3 args.

Found this while fixing D1239328

Reviewed By: @ptarjan

Differential Revision: D1241329
Fix default value for $def in Locale::lookup()

Otherwise we (may) have garbage data there.

Closes #2169

Reviewed By: @JoelMarcey

Differential Revision: D1239328
Fix constant branch elimination

Constant branch elimination wasn't working with bc control
flow because, if the target of a constant branch was also the target
of some prior branch, then startBlock() would try to add a fallthrough
block to the (now eliminated) branch.  This diff catches that case and
instead adds an explicit fallthrough jump during startBlock(), which
can be removed during jumpopts if the block layout allows.

Simple example exhibiting the problem:

     JmpNZ B
  A: True
     JmpNZ B
  B: ...

Reviewed By: @oyamauchi

Differential Revision: D1243443
update string count in out2expectf.py

Reviewed By: @fredemmott

Differential Revision: D1243512
Make statSyscall in ext_file.cpp support relative paths by default.

This fixes a number of php5 incompatibilities -- specifically this fixes #1733, and gives relative path support that should exist to is_readable, is_writable, is_executable, fileperms, fileowner, etc. (all the file* functions for extracting stat fields).
Closes #1983

Reviewed By: @fredemmott

Differential Revision: D1240987
Enable hard enforcement of return typehints by default

Reviewed By: @elgenie

Differential Revision: D1238170
still read config.hdf

If we can't read /etc/hhvm/php.ini, then try reading /etc/hhvm/config.hdf instead.

Closes #2193

Reviewed By: @fredemmott

Differential Revision: D1242801

Pulled By: @ptarjan
Kill atomic_acquire_load and atomic_release_store

I've had this task sitting around for ages, and I want to finally retire
it.

I'm concerned about some of these. It looks like they're trying to be
threadsafe, but they're failing. Here's a rundown:

- I either kept the semantics of SrcDB::m_topTranslation or made them
  more strict than before. However, there's a potential race at line 89
  (load-check-store). But isn't this whole thing always called inside
  the write lease, so topTranslation doesn't even need to be atomic?

- The other atomic_release_store in srcdb.cpp is pointless; it's
  smashing executable code, and the processor isn't going to fetch it
  with load-acquire semantics, so the store-release isn't doing anything
  beyond a regular store.

- NamedEntity::m_clsList being std::atomic is complex: everyone seems to
  be convinced that even if it's not atomic, nothing can possibly go
  wrong on x64, and the odds of something going wrong on ARM are
  astronomically low. But if it's not atomic, it's technically undefined
  behavior.

Reviewed By: @markw65

Differential Revision: D1237459
Drupal8 at 100%

- clownlist a flakey test
- disable warnings for one test (fails under php5 too with warnings on)

Reviewed By: @JoelMarcey

Differential Revision: D1245226
Default display_errors to stderr if enablehiphopsyntax is on

- Default needs to be stdout for full php5 compatibility
- stderr is standard practice outside in the unix world, for good reasons

Reviewed By: @edwinsmith

Differential Revision: D1244411
Revert "Convert ext/mysql to HNI"

This reverts commit 3df595618d9d31d72e0a98b8e4a6ae29c83451ca.

Reviewed By: @jdelong

Differential Revision: D1245892
re-record reactphp

100% :D

Reviewed By: @JoelMarcey

Differential Revision: D1246372
Fix bugs related to old style constructors

Consider:

  class base {
    public function base() { ... }
  }

  clase derived extends base {
    public function base() { ... }
  }

  $d = new derived;

This would emit a FPushCtorD. When it got to annotate(), it would
annotate the push with the class name of the object ("derived") which
would end up calling "derived::base" instead of "base::base".

HHBBC had a similar bug where it assumed that a resolved ctor would
match the resolved class, making an FCallD "derived" "base".

Reviewed By: @markw65

Differential Revision: D1244171
Clownlist a frequently-hanging joomla test

Frequently blocks test runs

Reviewed By: @JoelMarcey

Differential Revision: D1246671
Break a bytecode dependency in the refcount optimizer

This is with the aim of unit-testing this component. In general, I think
knowledge like this (is it in a generator?) that we're gaining from
looking at bytecode should be encoded in the IR if it's necessary.

Anyway, what this code is actually interested in checking is (a) is it
the last instruction in an exit block; (b) is it NOT a RetCtrl from a
non-generator; (c) is it NOT in the catch block of a non-generator's
FunctionExitSurpriseHook. All this information is already there in the
IR.

Reviewed By: @bertmaher

Differential Revision: D1246382
Don't clobber the m_aux field

Various arithmetic operations are used to write
directly into arrays, where the m_aux field has a special
meaning, and mustn't be overwritten.

Reviewed By: @jdelong

Differential Revision: D1247497
Allow http_response_code in CLI mode

- Added variable to remember response code state instead of solely depending on the transport

Closes #1352

Reviewed By: @ptarjan

Differential Revision: D1229093
fix segfault when cloning objects

ObjectData::cloneSet makes the false assertion that an objects dynamic
properties can only have string-based keys.

When casting an array with numeric keys to an object and then cloning
this object will cause HHVM to segfault due to lack of KindOfInt64
support.

Closes #2200.

Reviewed By: @edwinsmith

Differential Revision: D1248203
Fix issues with DynamicInvokeFunctions

Several smallish changes are combined in this diff:

  - Merge systemlib on every request if anything in it is is not
    persistent because it was a DynamicInvoke.

  - Rename DynamicInvoke internally to Interceptable, and add various
    comments about what it means.  External option is not renamed for now.

  - Undo the portion of eletuchy's diff that disables rename_function
    on AttrInterceptable functions if EnableRenameFunction is false.

  - always_assert in fb_rename_function that we aren't going to
    clobber a persistent RDS handle.

  - Raise an error if you call an fb_intercepted function in repo mode
    that wasn't listed as an interceptable function at compile time.

  - Make interceptable methods work in hhbbc (only functions were
    being done right).

Also for now this diff doesn't try to solve the issue that the value
of a compile-time "enable rename function" flag could differ from the
runtime value and break everything.  And for now it doesn't remove the
RuntimeOption::DynamicInvokeFunctions which can also be used to break
everything.

Reviewed By: @markw65

Differential Revision: D1244808
Fix a bug in JIT'd FPushClsMethodD in repo mode

If you are in an instance method, calling to an instance
method in a subclass with static syntax, we need to pass the $this
pointer along.  We diverge from zend in that we only carry $this along
if the current instance is a subclass of the subclass you are
dispatching to, so it's easiest to punt this for now to get it right.

Reviewed By: @elgenie

Differential Revision: D1245122