Change UserFile::access behavior to match official.

Summary: In official implementation, is_executable() for directory in custom
protocol always return false. Change UserFile::access behavior to match
that behavior.

Fix vfsstream's directoriesAndNonExistingFilesAreNeverExecutable test.
Closes https://github.com/facebook/hhvm/pull/4096

Reviewed By: @ptarjan

Differential Revision: D1646140

Signature: t1:1646140:1414581586:d832b0a8b47df1a7c10236ea1bb4f7b650718abf
Steal one of the extra ObjectHeader bytes

Summary: We need a free byte in ObjectData to overlap with ArrayKind and/or
Collection::Type. The only use of subclassData.u8[1] was WaitableWaitHandle.
Due to field padding, adding a new context_idx_t field to WaitableWaitHandle
does not change the size of any concrete subclass except
AsyncGeneratorWaitHandle.

Reviewed By: @elgenie

Differential Revision: D1643614
Convert stream to HNI

Summary: fixes #3966

Reviewed By: @ptarjan

Differential Revision: D1615755
Convert socket to HNI

Summary: fixes #3951

Reviewed By: @ptarjan

Differential Revision: D1615554
mark getPrevVMState as UNSAFE

Summary: This function can break all sorts of assumptions the JIT makes and crash HHVM. Lets put a little barrier into the mind of a person using it.

The common and safe use is to just get the previous Func*.

Reviewed By: @jdelong

Differential Revision: D1638947
add option to make iconv actually match the docs

Summary: On the docs http://php.net/manual/en/function.iconv.php they give this example:

```
<?php
$text = "This is the Euro symbol '€'.";

echo 'Original : ', $text, PHP_EOL;
echo 'TRANSLIT : ', iconv("UTF-8", "ISO-8859-1//TRANSLIT", $text), PHP_EOL;
echo 'IGNORE   : ', iconv("UTF-8", "ISO-8859-1//IGNORE", $text), PHP_EOL;
echo 'Plain    : ', iconv("UTF-8", "ISO-8859-1", $text), PHP_EOL;

?>
```

which should output

```
Original : This is the Euro symbol '€'.
TRANSLIT : This is the Euro symbol 'EUR'.
IGNORE   : This is the Euro symbol ''.
Plain    :
Notice: iconv(): Detected an illegal character in input string in .\iconv-example.php on line 7
This is the Euro symbol '
```

but if you run it on PHP http://3v4l.org/k615V the `//IGNORE` case is broken.

I think what the docs say is best, and looks the most sane, so lets make the language better.

Reviewed By: @paulbiss

Differential Revision: D1646046

Signature: t1:1646046:1414598441:eeb6befb62a8beec215df76d134a036f45589f9f
Fixed iconv() error behaviour - take 2

Summary: This reverts commit 4faec5261e6adfea81e8e66379470d71b24976fd.

With D1646046 we can keep the better //IGNORE behaviour

Reviewed By: @paulbiss

Differential Revision: D1646155

Signature: t1:1646155:1414598669:f7d88607ceda773350dbb1a14c2e61b1ab616dd0
move binary ignores into hphp

Summary: We have the tree inverted internally so ignored things have to be in this dir instead of the root dir.

Reviewed By: @JoelMarcey

Differential Revision: D1646172

Signature: t1:1646172:1414598925:09a541432cf88fff354819670c87260b221d157d
move slow 'quick' tests to 'slow'

Summary: The minimum overhead for a test run is 0.8 seconds, so I made the cutoff at 2x that and moved anything over 1.6 seconds to slow/lang. One of the tests was obviously i18n so I moved that to test/slow/intl/

Timed with:

    for i in `ls -1 test/quick/*.php`; do echo -n "$i "; /usr/bin/time test/run $i 2>&1 | grep user | sed s/user.*//; done > /tmp/a

Reviewed By: @swtaarrs, @JoelMarcey, @bertmaher, @paulbiss, @jdelong

Differential Revision: D1639378
Move hfsort linker script tool to oss

Summary: A few small mods to make sure hfsort emits a gold compatible function ordering file.
Interesting parts of the internal commit history are below.
Hat tip goes to bertrand, ottoni, twoh.

  Author: Taewook Oh <twoh@fb.com>
  Date:   Wed Sep 3 16:40:17 2014 -0700

    implementation of pettis-hansen algorithm

    Summary:
    ^ Title. Binary hfsort and pettis-hansen will be created in the
    separate subdirectory, and hf-process.sh script has fixed to reflect the new
    location of hfsort binary. This version generates callgraph from the linux perf
    result. Once checked-in, I'll add the version that uses Pintool to generate
    call-graphs. Even for Pettis-Hansen, clusters are sorted by density.

    Test Plan:
    The log file out of hfsort and pettis-hansen run showed that both
    algorithms worked as expected. Profile for test runs were collectd by running
    hf-prod-collect.sh

  Author: Guilherme Ottoni <ottoni@fb.com>
  Date:   Mon May 19 12:19:04 2014 -0700

    [linker_script] Disable frozen pages, and set page size to 2MB

    Summary:
    The "frozen" pages helped to keep really hot small functions in a few
    4KB pages, but since we moved to using huge pages, we can disable
    that.  This allows these functions to be clustered with some of their
    callers and/or callees.  This diff also sets kPageSize to 2MB to
    reflect the current use of huge pages, although this only affects
    tracing output with frozen pages disabled.

    I considered just killing the code related to frozen pages, but
    decided not to because we've talked about potentially using this for
    other projects or open source users that may not use huge pages.

  Author: Guilherme Ottoni <ottoni@fb.com>
  Date:   Fri Nov 8 15:48:18 2013 -0800

    Use dynamic call graph information to sort hot functions for the linker

    Summary:
    This diff leverages the call graph information from perf to produce a
    code layout with better locality, in addition to the density (samples
    over size) metric that was in use.

    There's a large space of heuristics that can be used.  The current
    version still uses purely the density metric to place the first few
    (4) pages.  The remaining functions go through a clustering pass that
    considers combining a function's cluster with the cluster for the
    function's most common caller.  The resulting clusters are then placed
    according to the same density metric.

    There are a few knobs in the beginning of hfsort.cpp that can be
    tuned.

Reviewed By: @ottoni

Differential Revision: D1644904
the things I wanted from the phar fix

Summary: on https://reviews.facebook.net/D27609 I didn't want to wait and just landed it

Reviewed By: @fredemmott

Differential Revision: D1646082

Signature: t1:1646082:1414612015:080f63c215104dbb830477b75128cdc85fde2474
Run a pile more OSS tests on every change

Summary: watchtheworldburn

Reviewed By: @ptarjan

Differential Revision: D1641924

Signature: t1:1641924:1414612875:d23f5c48be39419e5b2d1fdb5b07fd545e9cdafc
Proper PDO connectione errors

Summary: Use the error code and message returned from the PDO driver instead of
using a generic error message when a PDO connection fails.

Closes #3467.
Closes https://github.com/facebook/hhvm/pull/4053

Reviewed By: @ptarjan

Differential Revision: D1637717

Signature: t1:1637717:1414620461:1a83489e9ee93cafb516de614ee271e19b1e955b
Experiment: One cache property per object

Summary: The yield->memoize codemod currently shows a pretty serious memory regression. While having a property for each memoized funciton should save memory over one caching array should save memory if nearly every memoized function is used, one theory is that the average percentage of called yieldFoo() functions on objects is so low that this actually turns into a regression. This diff used one cache array per object like DynamicYield to test out that theory

Reviewed By: @jano

Differential Revision: D1644721

Signature: t1:1644721:1414626585:c8d2ba6d2f8d0282313a7292375451e6826ceb16
Only try to autoload classes with valid names

Summary: spl_autoload_register(function($class) { require "/my/classpath/$class.php"; });

means

    $class = $_GET['view_module'];
    new $class();

is now an RCE using /?view=../../../../../../../var/log/httpd/access_log%00

It should only allow characters that are valid in class names.

Reviewed By: @markw65

Differential Revision: D1556938

Pulled By: @ptarjan
Move m_lineTable to a side table

Summary: It's only needed when we have a Unit that isn't backed by a repo, like
the one we create to run debugger commands.  Cache it when emitting the unit,
and look it up whenever we need line number information.

Depends on D1616637

Reviewed By: @jdelong

Differential Revision: D1639505

Signature: t1:1639505:1414521648:0e70e77d7a23ef01940d2a5c2cc6129b0be74a4c
Reduce X-macro use in RepoProxies

Summary: The X-macro pattern for the various RepoProxy objects seems a bit
too complicated for what it does.  I've reduced the amount of generated stuff
and mostly gotten rid of the X-macros (except for in UnitRepoProxy, where the
amount of redundancy really does get extreme).

Reviewed By: @jdelong

Differential Revision: D1641280
Don't populate the litstr-to-id map in RepoAuthoritative mode.

Summary: We only use this map to dedup strings while building the repo; we don't need it to load the repo.

Reviewed By: @markw65

Differential Revision: D1642663

Signature: t1:1642663:1414542772:57f7415ad9a99dc34154f1b09ae5929a071dddca
Remove type annotations for `array_sum` and `array_product`

Summary: Sadly they break FB www, and I don't think they are important
enough to `HH_FIXME` everywhere. If we think they are, we should fix www
*first* so that poor bootcampers who are trying to make sure their
change works aren't blindsided by random breaks like this :)

Reviewed By: @elgenie

Differential Revision: D1648201

Signature: t1:1648201:1414626068:83049b79dc2f1f3840b566c136a628f667ce00a8
Convert system/idl/function to HNI

Summary: Convert system/idl/function to HNI.
Also fixes compatibility with PHP, when func_get_arg() is called with non-integer parameter.

Part of https://github.com/facebook/hhvm/issues/1480.
Closes https://github.com/facebook/hhvm/pull/3942

Reviewed By: @​svcscm

Differential Revision: D1608060

Pulled By: @ptarjan