ext_zend_compat improvements

These were brought on by importing `fileinfo`. I ended up doing it natively in HHVM, but these bugfixes are still useful. The worst part is the preg stuff since our code diverged so much from zend I had to just copy theirs. Some day we hopefully can reconcile them.

Reviewed By: @paroski

Differential Revision: D1025745
import files even if they have an ini section

I was lying a little bit and not importing these tests since they have no chance of passing since our INI story sucks. I think we shouldn't be cheating with our numbers and instead should have these and be able to work towards them passing.

Reviewed By: @JoelMarcey

Differential Revision: D1082559
remove functions we don't implement

These fly completly in the face of the `function_exists` detection that you are supposed to use. The worse offender was a completly unimplement extension of image magic.

I ran `git grep` in `runtime/ext`

Reviewed By: @sgolemon

Differential Revision: D1088798
mark systemlib classses as \!isUserDefined()

I can't beleive we lived this long with this `if (false)`

Reviewed By: @alexmalyshev

Differential Revision: D1088081
update PCRE_VERSION

Stop lying. Symfony checks this and throws a warning saying we are too old when we aren't.

Reviewed By: @sgolemon

Differential Revision: D1088930
Hook IniSetting::Bind to ini_get()

This started as a small diff to get `date.timezone` working and escalated to this.

I did it as a small change with just adding a get callback to the bind call and used it during the get. I debated having a side-index of everything that has been set so far and echo it back, but the setting might muck with the data before saving so I think this is more generic.

I think in a perfect world you could just register their name, type, and an optional validator, but that's for later when this gets cumbersome.

Reviewed By: @sgolemon

Differential Revision: D1088980
Pass the length along when outputting from printf

If there's no length, the result is treated as a
null-terminated string which means that null characters incorrectly stop
the output.

Closes #1322

Reviewed By: @ptarjan

Differential Revision: D1087212

Pulled By: @scannell
Parameterize XLS with a register abi descriptor.

Create an Abi POD struct that encapsulates details about the
ABI that the register allocator needs to know.  For now, it's
just what register are available to be allocated and which
ones are callee-saved registers.

Reviewed By: @jdelong

Differential Revision: D1088590
Fix typos (src)

Fix typos (src)

Closes #1329

Reviewed By: @edwinsmith

Differential Revision: D1089170

Pulled By: @scannell
Re-introduce MySQL 5.6 client

This reverts e5cdbb1a67f28f94d43c83ff2627fd3eff8b3646 which
reverted the original 5.6 client update based on the issue from 3340526.
With third-party patched with D1088527 fixing the double-close, this
diff restores 5.6 to fbcode.

Original 5.6 diff: D1058111
Reverted in: D1087701
MySQL fixed in: D1088426
third-party patched in: D1088527

Reviewed By: jicongrui

Differential Revision: D1088758
Speed up simulator's register-smashing code

I feel bad, because I wrote this originally. perf showed that this code
was really hot, so I rewrote it much simpler. I also fixed some mistakes
in the register-convention constants provided by vixl. This seems a
little wtf, but what they had there before definitely doesn't agree with
the documentation, as well as the implementation of
vixl::CPURegList::GetCallerSaved.

Reviewed By: @jdelong

Differential Revision: D1087062
Use getScalarValue instead of ad hoc cases for scalar array pairs

Reviewed By: @markw65

Differential Revision: D1024221
Propagate states across factored edges mid member-instruction

Member instructions are fairly unusual in that they can throw
with a state reflecting changes in the middle of their execution.  The
normal model in HHBBC for PEIs (potentially exception-throwing
instructions) is to propagate the state before the instruction has
begun execution, so these need to be handled specially by explicitly
propagating the states before each dim.

Reviewed By: @edwinsmith

Differential Revision: D1088633
Add an hhas test case for DV initializers with fault/catch regions

From what I can tell, nothing rules this out in the bytecode
spec.  Wrote this to see if it actually worked, which it seems to.

Reviewed By: @edwinsmith

Differential Revision: D1010605
Relax bytecode invariants about DV initializers

DV initializers had some rules about fallthrough, jumps to
the main entry point, and a requirement that they each only be a basic
block.  We violate these rules in array_filter.hhas and
array_map.hhas, and they currently don't seem to be needed.  This
changes the spec so they are just alternative entry points based on
argument count, and updates hhbbc to not assume those things.  We
still have a few reasonable rules about where the entry points can be
(they must be in the primary function body, and cannot be in the
middle of an FPI region).

Reviewed By: @edwinsmith

Differential Revision: D1088641
Improve printing of ?Obj types

Reviewed By: @edwinsmith

Differential Revision: D1088697
Typo: compatability -> compatibility (II)

Typo: compatability -> compatibility (src)

Closes #1328

Reviewed By: @edwinsmith

Differential Revision: D1089152

Pulled By: @scannell
fixup yaml to be c++ compliant

`fpermissive` is bad and we shouldn't set it

Reviewed By: @scannell

Differential Revision: D962946
Fix read past end of buffer in IpBlockMap

The code used to allow a read of the bit immediately past
the end of the buffer - and since both children should be nullptr
in that case, the value doesn't matter. But its still an illegal
read, and the ASAN build was catching it.

Reviewed By: @edwinsmith

Differential Revision: D1089631
fix stream_get_contents when no offset is specified

File does its own internal buffering and uses m_readpos, m_writepos,
m_position for the purpose of keeping track of file offsets. This means
that current (PHP) position is not in sync with the underlying file
descriptor (m_fd).

This works fine, were it not for the fact that ext_stream calls directly
into pure virtual method readImpl that generally lives in PlainFile
and works directly on the file descriptor that might contain an
invalid (buffered-ahead) position.

This pull request does several things:
- Remove default value 0 for File::read(int64_t length), since that
  implementation returns earlier for 0 values anyway.
- Implement an overloaded method File::read() that reads the remainder
  of the file (until EOF) by using proper File::m_* properties.
- Make ext_stream call into File::read instead of PlainFile::readImpl.