HHVM should compile with libmemcached 1.0.9+

libmemcached 1.0.8 broke the memcache/memcached extensions. It
is also missing some API support we need, so this should unbreak us as
of 1.0.9+. 1.0.8 plain won't work but earlier and later will.

Closes #934
Closes #973

Differential Revision: D939850
Fix generator-related errors in PHProf output

Fire EventHook::FunctionExit() in the correct places for generators. This was happening during Continuation destruction, which is quite a while after we exit the continuation, and causing double notifications for continuation exits. Also fire the event when unwinding out of a generator, since that one was missing.

Differential Revision: D939893
Fix Zend string_crypt() to report failures properly

strdup(crypt_r()) can result in a segfault
if crypt_r() returns null.

Closes #983

Differential Revision: D940753
Reinstate fb_setprofile

Its the only way we have for reliably testing hard to repro edge
cases (such as timeouts during FunctionEnter/FunctionExit) and I find it
very useful for debugging complex code.

Differential Revision: D941226
Improve 'string key not present' exception message for collections

At present the 'string key not present' exception message can be misleading
when the string key is truncated (which happens when the string key exceeds
20 characters) and this has caused some confusion.

This diff improves the exception message in two ways. First, the string key
will only get truncated when the key exceeds 100 characters. Second, the
exception message will make it clear when the string was truncated by
printing "(truncated)" after the string key.

Differential Revision: D940984
Support "tuple(..)" in initializer expressions

Differential Revision: D940814
Fix list assignment with collection literals

Doing "list($x,$y) = Vector {1,2}" should work. Make it so.

Differential Revision: D940987
Fix type aliases for function types

They were just broken.  Right now, even evaluating a unit
that is declaring one just leads to attempting to autoload the empty
string as a type alias (since it thinks the type alias was
KindOfObject).  Changes them so they work just like normal <?hh
function typehints (currently unchecked).

Differential Revision: D942768
Change StringSlice to take a uint32_t instead of an int

StringSlice{foo, bar} where bar is uint32_t produces an error
(in 4.7.1, 4.6 doesn't have this part of C++11 correct yet).

Differential Revision: D938436
Fix nemo issue (BadArgumentType) for type aliases to non-objects

At call sites, it was complaining because it thought an alias
parameter must be a name of an object.  Also make a function less
nested.

Differential Revision: D942157
Remove Array::addLval() methods, use lvalAt() instead.

The AddLval methods were fairly cold, so reimplement them in
terms of lval(), but preserve the assert that ensures the keys
being added do not already exist.  This reduces the number
of kind-specific methods we need to implement.

Added Array::setWithRef(key,value) to capture a common use
case for lvalAt().  Later this can implemented more efficiently
as a virtual method in ArrayData subclasses.

Differential Revision: D937227
Fix gettype() for resources

Differential Revision: D941144
Add CachingIterator

- Implement CachingIterator
- I ran the idl/sysdoc.php script on my file but it didn't do anything to it
- I started with https://github.com/php/php-src/blob/master/ext/spl/internal/cachingiterator.inc and then added everything that it was missing
- Some of the documentation at http://www.php.net/manual/en/class.cachingiterator.php is strange. All the offset function say that they take string arguments. But the class implements ArrayAccess which specify the arguments as mixed. So I went with mixed because otherwise I got a fatal
- I moved over all bad tests that are now passing
- The rest of the bad tests that test CachingIterator are passing too. It is just that error messages are different so I can't move them to good

Differential Revision: D942889
Handle $a[] = 1

- This is how Zend does it. If $index is null treat it as no $index at all

Differential Revision: D943043
Use "Packed" as the term for vector-like arrays.

The term Vector is getting too overloaded in our codebase.  Rename
vector-like array kinds to "packed" instead.

Differential Revision: D935245
Refactoring member-operations so each kind of base has its own function

I liked the results of some cleanup of SetNewElem, so I
decided to extend it to many of the other Elem* functions in
member-operations.h.  This diff really just moves code around to make
it easier to experiment with in the future.

Differential Revision: D932351
Use StringData::same() in a few more places to reuse code.

Now that same() has a faster comparison loop than memcmp,
use it in a couple more places.

Differential Revision: D942902