Add fuzzy results to search

Summary: Add fuzzy results to search results - in this case, fuzzy just means if the result is a common subsequence of the query. (i.e. 'hlo' matches 'hello', but 'hol' doesn't).
This means search only indexes methods (we don't fuzzy search those, there are too many, it just seems to clutter results and slow things down) and then aggregates the fuzzy search results.

It adds ~2s to startup time.

--------------------------
| Fuzzy Search Algorithm |
--------------------------

The algorithm is supposed to be fast to index, compromising with a slightly slower search time.
Here are some examples of what should match:
 - `search_term` -> `result`
 - 'heo' -> 'hello'
 - 'awtbl' -> 'Awaitable'
 - 'mthdy' -> 'MothersDay'
 - 'bsfcbktcs' -> 'BaseFacebookTestCase'
 - 'ExactMatch' -> 'ExactMatch'

1. Indexing
----
The index we build at a high level is simple: we build a map from letters to terms which contain those letters (in important places).  This means the term `Awaitable` lies under only 'a' and 'w', but 'someClass_here' lies under 's', 'o', 'c', and 'h'.
Note: This excludes the filter part, but each index also basically has 4 indexes, one for each filter type (Class, Constant, Typedef, Function)
Also note: We only index Classes, Constants, Typedefs, and Functions - regular search handles methods (there are just too many to index this way)

To index:
a.) Run workers over files, so no two workers can touch the same file
b.) Each worker will add to two shared memory objects:
    i.) a list of keys in the file
    ii.) a map from key to definition (where a definition is a name, location, and type)
 - The purpose of the key list object is so we can easily build a global list of all keys as well as check which keys are added/removed each time we index the file
 - The purpose of the map is so we can find the actual definition once we know the key is related to the search term.
c.) The master process then aggregates all the information from shared memory, checking the difference in each file compared to last indexing
d.) The master process the main index (map from letters to terms which contain the letters)
e.) It also builds a term lookup table, where we can lookup a term by it's key to find out which files it is in - this is used so we can find the actual definition object later, once we match

2. Searching
----
Searching is pretty simple: Get the first letter of the query, find the list of terms with that letter, and check every single term if it matches our search query.

To search:
a.) Cut the first letter off the query
b.) Lookup the list of terms which contain that letter (we indexed it earlier)
    i.) If there was a filter specified, only get the terms matching that type
c.) Compare our query against each term in that list
d.) If our query is a common subsequence of one of the terms, add it to the results list
e.) While we compare our query, we keep track of a score:
    i.) The more gaps there are between matching characters, the higher the score
    ii.) The more letters which are the incorrect case, the higher the score
    iii.) Direct matches have a score of 0.
    iv.) The later we find out that we've matched, the higher the score
    v.) Longer terms have higher scores
 - If your query is very spread out in the result, it's less likely to be what you're looking for.
 - The shorter the result, the closer the length is to what you searched for, so it's more likely.
 - The earlier we find the match, the more likely it is to be what you're looking for.
 - The more cases of the characters that match, the more likely it is to be what you're searching for
f.) Sort the results by the score
g.) Merge the results with regular search results (which indexes methods as well) - only if no filter was specified

Reviewed By: @joelbeales

Differential Revision: D1418856
Have liveTVType return an Obj=C instead of Obj<=C

Summary: It only specializes on NoOverride classes.

Reviewed By: @swtaarrs

Differential Revision: D1479030
Some random cleanup around FrameState.

Summary: No functionality changes.

Reviewed By: @ottoni

Differential Revision: D1480435
make SplFileObject__fgetcsv.csv not be shared by 8 tests

Reviewed By: @JoelMarcey

Differential Revision: D1480793
Enable file XML external entities for frameowrk tests

Summary: refs facebook/hhvm#3375

Doctrine2 uses these for some of its' tests. Still not back at 100% though.

Reviewed By: @JoelMarcey

Differential Revision: D1482233
Fix twital re-record - test find mode bad

Summary: refs facebook/hhvm#3381

Reviewed By: @JoelMarcey

Differential Revision: D1481847
unflakey md5 and sha1 test

Summary: failed on D1479623?vs=on&id=4750825&whitespace=ignore-all#toc

Reviewed By: @fredemmott

Differential Revision: D1482115
Lint fixes for man page

Summary: See rrh code review: https://github.com/facebook/hhvm/commit/e32f5bf0cc7a74d671c6922108c68bfbdfdbe1f4

Thanks rrh

Reviewed By: @fredemmott

Differential Revision: D1481918
Return false in fscanf if the file is empty

Summary: This will fix #3352.
Closes https://github.com/facebook/hhvm/pull/3364

Reviewed By: @LiraNuna

Differential Revision: D1478505

Pulled By: svcscm
hphp: placate newer clang regarding non-local lambda expressions

Summary: * hphp/hhbbc/test/type-system.cpp: Several non-local lambda
expressions needlessly used [&] ("capture-default").  Remove
the "&".  Here's a sample diagnostic:
  hphp/hhbbc/test/type-system.cpp:169:44: error: non-local lambda\
    expression cannot have a capture-default
  auto const test_empty_array = folly::lazy([&] {

For reference, here's the relevant part of the standard:
  C++11 [expr.prim.lambda]p9:
    A lambda-expression whose smallest enclosing scope is a block scope
    is a local lambda expression; any other lambda expression shall not
    have a capture-default or simple-capture in its lambda-introducer.

Reviewed By: @alexmalyshev

Differential Revision: D1482394
Don't #include libelf on OS X

Summary: We don't need libelf includes on OS X here; we have our own
implementation on Mach-O. Actually including the headers is annoying --
for compatibility reasons, OS X package managers to build libelf in
"disable compat" mode, which doesn't install these headers in
/usr/include, so you need to do `-I/foo/bar/libelf` -- but `libelf.h`
itself does a `#include <libelf/libelf.h>` so you //also// need
`-I/foo/bar` if `/foo/bar` isn't a standard include directory (again
common on OS X).

But this whole thing should be moot, we don't need it, just move it
under ifdef.

Reviewed By: @ptarjan

Differential Revision: D1482087
Kill JmpFlagBothPaths flag

Summary: Instead, just check if a block exists for that offset.
Also, clean up some stuff that became unnecessary.

Reviewed By: @swtaarrs

Differential Revision: D1478708
Fix bug in cgLoad

Summary: If the type is a subtype of Null, we early-exit. We already
detect the dead-load situation, and type of {InitNull|Uninit}
should go down the cgLoadTypedValue case, which should correctly
load.

Now that I look more closely I don't think this is a bug,
but the code was misleading.

Reviewed By: @swtaarrs

Differential Revision: D1478816
Rename JmpFlagBreakTracelet to JmpFlagEndsRegion

Summary: That's it.

Reviewed By: @alexmalyshev

Differential Revision: D1482019
Remove unnecessary abstraction from fastcgi server

Summary: I did this while trying to make sense of the current setup. The
ProtocolSession class didn't appear to serve any purpose so it's been collapsed
into the only subclass. I've also added brief descriptions of most classes
describing their role in the server, and made a few other cleanup tweaks.

Reviewed By: @ptarjan

Differential Revision: D1476104
Properly shut down fastcgi worker threads when connection is closed

Summary: If the fastcgi connection from the webserver was closed while a
request was reading its POST data, the worker thread processing that request
would get stuck indefinitely waiting for the rest of the data to arrive. Given
enough time, all worker threads in the server could get stuck, causing the
server to become completely unresponsive until a restart. Make sure we notify
the appropriate condition variable to avoid this.

Reviewed By: @ptarjan

Differential Revision: D1476306
Flakeylist mediawiki base conversion test

Summary: Becamse flakey with gmp extension. Same issue exists in PHP5 with gmp conversion - for example:

```
<?php
$in = '0x1234567890abhaer';
$gmp = gmp_init($in, 36);
$val = gmp_strval($gmp, 36);
var_dump(str_pad($val, strlen($in), '0', STR_PAD_LEFT));
```

https://bugzilla.wikimedia.org/show_bug.cgi?id=69249

Reviewed By: @JoelMarcey

Differential Revision: D1482806
Get rid of static Hdf instance in RuntimeOption.

Summary: Resubmitting D1458015.
Avoid constructing static Hdf instance in RuntimeOption.
Instead, registered a call back function in RuntimeOption ("HookOption")
which is called in Load().

Reviewed By: @markw65

Differential Revision: D1480544
Clownlist doctrine2 test that also fails on php5

Summary: refs facebook/hhvm#3375

```
Exception: [Doctrine\Common\Proxy\Exception\OutOfBoundsException] Missing value for primary key id on Doctrine\Tests\Models\CMS\CmsUser

With queries:
18. SQL: '"COMMIT"' Params:
17. SQL: 'INSERT INTO cms_users (status, username, name, email_id) VALUES (?, ?, ?, ?)' Params: '', 'ocramius', 'Marco', ''
16. SQL: '"START TRANSACTION"' Params:
15. SQL: 'CREATE TABLE cms_groups (id INTEGER NOT NULL, name VARCHAR(50) NOT NULL, PRIMARY KEY(id))' Params:
14. SQL: 'CREATE TABLE cms_emails (id INTEGER NOT NULL, email VARCHAR(250) NOT NULL, PRIMARY KEY(id))' Params:
13. SQL: 'CREATE UNIQUE INDEX UNIQ_ACAC157BA76ED395 ON cms_addresses (user_id)' Params:
12. SQL: 'CREATE TABLE cms_addresses (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, country VARCHAR(50) NOT NULL, zip VARCHAR(50) NOT NULL, city VARCHAR(50) NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_ACAC157BA76ED395 FOREIGN KEY (user_id) REFERENCES cms_users (id) NOT DEFERRABLE INITIALLY IMMEDIATE)' Params:
11. SQL: 'CREATE INDEX IDX_D533FD95A76ED395 ON cms_articles (user_id)' Params:
10. SQL: 'CREATE TABLE cms_articles (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, topic VARCHAR(255) NOT NULL, text CLOB NOT NULL, version INTEGER DEFAULT 1 NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_D533FD95A76ED395 FOREIGN KEY (user_id) REFERENCES cms_users (id) NOT DEFERRABLE INITIALLY IMMEDIATE)' Params:
9. SQL: 'CREATE INDEX IDX_F21F790FA76ED395 ON cms_phonenumbers (user_id)' Params:
8. SQL: 'CREATE TABLE cms_phonenumbers (phonenumber VARCHAR(50) NOT NULL, user_id INTEGER DEFAULT NULL, PRIMARY KEY(phonenumber), CONSTRAINT FK_F21F790FA76ED395 FOREIGN KEY (user_id) REFERENCES cms_users (id) NOT DEFERRABLE INITIALLY IMMEDIATE)' Params:
7. SQL: 'CREATE INDEX IDX_7EA9409AFE54D947 ON cms_users_groups (group_id)' Params:
6. SQL: 'CREATE INDEX IDX_7EA9409AA76ED395 ON cms_users_groups (user_id)' Params:
5. SQL: 'CREATE TABLE cms_users_groups (user_id INTEGER NOT NULL, group_id INTEGER NOT NULL, PRIMARY KEY(user_id, group_id), CONSTRAINT FK_7EA9409AA76ED395 FOREIGN KEY (user_id) REFERENCES cms_users (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_7EA9409AFE54D947 FOREIGN KEY (group_id) REFERENCES cms_groups (id) NOT DEFERRABLE INITIALLY IMMEDIATE)' Params:
4. SQL: 'CREATE UNIQUE INDEX UNIQ_3AF03EC5A832C1C9 ON cms_users (email_id)' Params:
3. SQL: 'CREATE UNIQUE INDEX UNIQ_3AF03EC5F85E0677 ON cms_users (username)' Params:
2. SQL: 'CREATE TABLE cms_users (id INTEGER NOT NULL, email_id INTEGER DEFAULT NULL, status VARCHAR(50) DEFAULT NULL, username VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_3AF03EC5A832C1C9 FOREIGN KEY (email_id) REFERENCES cms_emails (id) NOT DEFERRABLE INITIALLY IMMEDIATE)' Params:
```

Reviewed By: @JoelMarcey

Differential Revision: D1482260
Added xdebug server setup code

Summary: This diff adds a class "XDebugServer" that represents an xdebug remote
debugging server. The server is attached and detached in `ext_xdebug.cpp`
similar to the `XDebugProfiler`.

This diff also adds support for taking in config settings using the
environment variable `XDEBUG_CONFIG`. This is necessary for supporting
all the server options php5 xdebug does.

I've also changed the request local data to be thread local. Attaching
the server (in the next diff) revealed some bugs in the current
implementation.

Depends on D1471865.

Reviewed By: @ptarjan

Differential Revision: D1472286