fixed serialize/unserialize for SplObjectStorage

added error handling for bad serialized strings according to zend tests.
We cannot move the actual tests from "bad" to "good" because ATM they
rely on the internal serialized string format of SplObjectStorage, which
is not yet reimplemented.

Closes #969

Differential Revision: D935251
Remove some dead profiling code

This profiling path was unused after D894723. Removing it.

Differential Revision: D934477
multiple simplexml fixes

- multiple fixes for simplexml required by magento

Closes #790
Closes #819
Closes #955

Differential Revision: D925428
move more helpers out of code-gen

Move more stateless platform dependent and agnostic helpers out of
code-gen.cpp

Differential Revision: D936727
use trigger_error in PHP for Redis user errors

- trigger_error is intended for reporting user errors, not
error_log

Closes #970

Differential Revision: D937921
Reduce bad error spam on too few arguments

function foo($bar, $baz) { }
  foo();

Currently raises two errors:

  foo() expects exactly 2 parameters, 0 given
  foo() expects exactly 2 parameters, 1 given

Only the first of these is either meaningful or correct.
Stop reporting once we've raised it.

Differential Revision: D939810
fallback to default separators in number_format

When number_format receives 'null' for one of its separator parameters,
we must pass it back to t_number_format so it can decide whether or not
it should fallback to its default separators.

Currently, when passing NULL to a parameter that is defined as String,
it is implicitly converted to an empty string, and subsequently
str.isNull() will return false.

Instead, we use a Variant with a default string value.

Closes #982

Differential Revision: D940482
ReflectionProperty(null,null) should throw

ReflectionProperty constructor should reject nulls

Closes #975

Differential Revision: D939337
Support "(new Vector {..})->method()" style syntax

This diff adds support for calling methods directly on collection literal
expressions (as long as the collection literal is wrapped in parentheses).

Differential Revision: D940562
Move util/zend (which defines zend.a) up one level.

And rename _ to - while we're at it.

Differential Revision: D925182
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