Implement Fast CGI support

Split the monolithic functions preparing special variables such
as $_REQUEST or $_SERVER into multiple functions to enable feeding of
data from multiple sources. In case of FastCGI protocol, the values are
sent by the web server.

Import parts of proxygen and thrift.

Added #ifdef's to allow compilation with an unpatched version
of libevent library.

Reviewed By: @ptarjan

Differential Revision: D988737
Differential Revision: D1008756
Differential Revision: D1021808
Differential Revision: D1035231
Wrap "test/slow/collection_classes/817.php" within a main() function

Eugene found some bugs with collections when he wrapped some of the our
collections tests inside a "main" method. These bugs have since been fixed,
so we can update collections tests that are not wrapped in "main" methods.

Reviewed By: @ptarjan

Differential Revision: D1041602
Revert "Relax guard on input of SetM"

: This reverts commit 8bd12391c963659e70a46562776a9e6aeb842c7f.

Reviewed By: @ottoni
Fix the timeout issues when running framework tests.

I was checking for false on stream_select; I needed to check for 0 instead.

Reviewed By: @ptarjan

Differential Revision: D1042557
Remove dead shared memory code

Removing dead shared (between processes) memory code and doc references

Reviewed By: @markw65

Differential Revision: D1042569
Clean up codegen for InstanceOf

instanceOfHelper was just a thin wrapper around Class::classof. Do the
null check in the TC and call classof directly. I also get rid of a null check
in classof which trimmed down its assembly a bit.

Reviewed By: @jdelong

Differential Revision: D1042062
Implement PDO::sqliteCreateFunction

This function is already implemented as SQLite3::createFunction, however
PDO is expected to have it's own version of it as well. I leaked some of
the SQLite3 declarations over to PDO to get it to work.

Zend just duplicates all the functionality between PDO and SQLite3, for
instance 'php_sqlite3_func_callback' and 'php_sqlite3_callback_func' are
the same function just in different files...

Reviewed By: @ptarjan

Differential Revision: D1039095
Streamline string_replace()

I noticed this was hot in perf, so I did some standard streamlining:
- have the string functions use String(ReserveString) instead of malloc
- switch a std::vector to smart::vector
- inline the small String::replace() wrapper functions
- mark f_string_replace and string_replace() as HOT_FUNCTION

Reviewed By: @jdelong

Differential Revision: D1041907
Remove StaticMethodCache::lookup, since lookupIR has supplanted it

It's dead, Jim.  Also rename lookupIR -> lookup, since
there's no distinction any more.

Reviewed By: @swtaarrs

Differential Revision: D1042980
Batched apc_store and apc_add support

Added support for passing arrays to apc_store/add instead of key,value pairs one at a time. Sharing an early
version to get code review feedback.

Reviewed By: @paroski

Differential Revision: D1037553
cast instead of L

crossplatform

Reviewed By: @alexmalyshev

Differential Revision: D1043270
Fix "Nothing to do" errors coming from PHPUnit test suite

We were getting errors like: PHPUnit_Framework_Exception: HipHop Notice: Nothing to do. Either pass a .php file to run, or use -m server.

It had to do with running php in processes and passing php code via stdin. We need the php wrapper/symlink to hhvm instead of the explicit hhvm binary.

The fix was to fork phpunit, make a change to their getphpbinary() function to check for an environment variable that we then set in this script. Then we upstreamed that fix to the master phphunit branch and it was quickly accepted (that was nice!)

Also added @elgenie fork for Slim as well.

Reviewed By: @ptarjan

Differential Revision: D1043544
don't emit warning with empty haystack

zend doesn't emit a warning

Reviewed By: @alexmalyshev

Differential Revision: D1043427
Use a different stream timeout approach

fgets was not working. stream_select seemed ok, but fgets seems to block anyway if only a certain amount of data is available without a newline. Use an fread(), character by character approach.

Reviewed By: @ptarjan

Differential Revision: D1043978
HHProf: Support showing all allocations

Add a mode for HHProf where all allocations are shown. This
isn't helpful for leak tracking or looking at what memory is still
alive, but this allows visibility into allocation patterns that would
otherwise be hidden because they are balanced.

Reviewed By: @mikemag

Differential Revision: D1042696
now isCallable won't die if there isn't a type_hint

Reviewed By: @dariorussi

Differential Revision: D1042437
expose dynamic properties in reflection

ReflectionClass supports taking an object and should use the dynamic props from it. @alexmalyshev is going to send a diff about default, so we'll have to co-ordinate whoever lands first.

Reviewed By: @elgenie

Differential Revision: D1043099
Move the rest of Type's methods into type.cpp

Reviewed By: @jdelong

Differential Revision: D1043399
use a different config for frameworks

@elgenie had a good point that we don't want to turn on hiphop syntax for the frameworks.

Reviewed By: @elgenie

Differential Revision: D1044204