Assign php token constants based on actual lexer token values

Omit the values from constants.idl.json, and provide them
via hphp.tab.hpp.

Differential Revision: D957423
Delete unused hphpc list assignment code

Differential Revision: D959103
Fix stream_socket_recvfrom & stream_socket_sendto

IPv6 addresses for stream_socket methods in PHP must be bracket
enclosed.

Differential Revision: D958537
libmemcached support for all 0.4x+ versions

It turns out the Ubuntu 12.04 image I thought was using 1.0.16
was using 0.44 and OSX was using 1.0.17. This should fix compilation on
libmemcached 1.0.8 - 1.0.16.

Closes #1022

Differential Revision: D957901
Make test/run's finding repo compiler more robust

Use hhvm --hphp instead of hphp to find the repo compiler as it
is more portable

Differential Revision: D959508
Implement str_getcsv, and fix some fgetcsv related issues

str_getcsv is now just a wrapper around fgetcsv

Differential Revision: D958124
Improve substr zend compatibility

Fixed issues with negative and out of bounds start position
and length

Closes #1031

Differential Revision: D959015
Fix a bug in interpOutputType

We weren't properly handling OutCInput or OutCInputL.  In
practice this means if we interpOne an Unbox or CGetL3 of a reference
type we could generate code that will fail on a later run if it is not
monomorphic.

Differential Revision: D958269
remove config.hdf from test/slow

I keep adding tests in there and I hate that the warnings aren't in the output. This was pretty straightforward:

1) Delete the config.hdf
2) Run all the tests
3) `./tools/out2expectf.py test/slow/*/*.php test/slow/*/*/*.php`
4) `find test/slow -name "*.except" -exec rm {} \;`
5) Fix other broken things

The things I had to fix by hand were:
a) tests with invalid unicode in them that out2expectf choked on
b) tests whose output is too long for a .expectf file. Thankfully they didn't have any warnings.
c) `strtotime_leak.php` was somehow leaking with the default config
d) some tests are different in repo mode, I'm digging into those now

Differential Revision: D958390
Differential Revision: D959973
Check for capacity overflows when doing StringData geometric growth

It wasn't checking, which means you can make a string bigger
than StringData::MaxLen---the length you ask for in reserve() the
first time is compared with the max length, but you may end up with
more capacity than that and later calls are only checked against
capacity().  StringBuffer will also use this capacity as if it is
within range.  Also add a checkSane() assertion in the resize path.

Differential Revision: D954757
Use IRFactory& everywhere.

We were randomly using * and &, and sometimes even *const, to
pass around IRFactory pointers, which are never reseated.

Differential Revision: D958962
Fix crash when registering stream wrappers

Stream wrappers were not being destroyed properly at the end of
a request, resulting in strange behavior / crashes if the same wrapper
was registered across multiple requests. This affects Drupal. Sample
code:

<?php
class stream{
  public $name;
}
stream_wrapper_register("public", "stream");
stream_wrapper_register("private", "stream");
stream_wrapper_register("AA", "stream");
var_dump(stream_get_wrappers());

Closes #849
Closes #1032

Differential Revision: D959563
Fix pseudo-virtual dispatch of ToArray and Clone with collections

Turns out you can override collection classes, if you use the
__MockClass user attribute. We have to use instanceof instead of direct
m_cls comparison.

Also, not_reached() has surprising behavior in build configurations
where ##assert(false)## is a no-op -- because of the not_reached, the
compiler was optimizing out the final else-if branch of the chain,
assuming that it could only go one way. Replaced those
with ##always_assert(false)##.

The implementation of c_Pair::Clone wasn't quite right either -- it
wasn't checking for a user-defined __clone function. You have to go
really out of your way to observe incorrect behavior because of this,
but it's doable. Also the elm0 and elm1 members weren't necessarily
initialized (I think). This change can't hurt, anyway.

Differential Revision: D959327
vixl 1.0 -> 1.1

Merge vixl 1.1 into fbcode

Differential Revision: D957520
Replace TraceBuilder* with TraceBuilder& everywhere.

We never reseat the pointer, and it's generally a contextual
object where it's used.

Differential Revision: D958964
Eager execution of async function.

Currently, a call to an async function returns a (Continuation)WaitHandle
object but the excution of the function body doesn't start before await
(or join()) on the WaitHandle is called. This changes it to start the
execution immediately and the control is returned to the caller only
after it's blocked.

Differential Revision: D946914
Hack collections support in json_decode

Two custom flags for json_decode are added:
 - FB_JSON_COLLECTIONS to output Vectors/Maps instead of arrays
 - FB_JSON_STABLE_MAPS to output StableMaps instead of Maps

Differential Revision: D950743
boost::{dynamic|static}_pointer_cast -> HPHP namespace

The primary goal here: move the custom overloads for `hphp_raw_ptr` of static/dynamic cast in `Base.h` out of the boost namespace, into HPHP namespace (which already uses normal boost versions). This means all casting, to be consistent, should happen in the HPHP namespace

Differential Revision: D959867
fix 2 trunk tests

1 I accidentally removed the %d which is needed since differnet filesystems report differnet sizes, and the other started emitting warnings since calling `get_class(null);` is bad

Differential Revision: D960488
Version agnosticism in sqlite error message

Error message can sometimes read
  "unfinalized statements or unfinished backups"

Differential Revision: D960619