EZC: clear EG(exception) on return from zend_wrap_func()

Summary: Otherwise, if the exception is caught and then control is returned into
a zend_call_function() call which wrapped the throwing function, then
zend_call_function() will erroneously rethrow the exception, even though
it has already been handled.

https://bugzilla.wikimedia.org/show_bug.cgi?id=71174
Closes https://github.com/facebook/hhvm/pull/3834

Reviewed By: @ptarjan

Differential Revision: D1574411
Fix Memcached::(inc|dec)rement(ByKey)? when ASCII protocol is used

Summary: We weren't correctly dispatching to the right memcached_* function,
causing it to always fail when using the ascii protocol. There's still one
divergence from PHP5: if an initial_value is given but the connection is using
the acsii protocol, PHP will raise a warning and return false, but we'll
silently ignore the initial value and continue on with the increment. Details
are in the comment.

Closes https://github.com/facebook/hhvm/issues/3839

Reviewed By: @ptarjan

Differential Revision: D1579907
Support custom stream wrappers in XMLReader::open()

Summary: This is similar to the treatment that was applied to a few other places in
842d6fb7dcd6d: manually create an IO object and use that to create the
xmlTextReader, rather than just calling xmlReaderForFile. This fixes web
importing of pages in MediaWiki.

Closes https://github.com/facebook/hhvm/pull/3840

Reviewed By: @ptarjan

Differential Revision: D1576426

Pulled By: @swtaarrs
Make RUSAGE_THREAD available to getrusage PHP function

Summary: The signature of the PHP function is getrusage( [ int $who = 0 ] ).
In both HHVM and PHP5, $who can be 1 to request RUSAGE_CHILDREN data. This
change allows $who to be 2 to request RUSAGE_THREAD data. RUSAGE_THREAD
measures resource usage for just the calling thread.

This allows HHVM PHP code to measure resource usage for the current request.
(In PHP5 this can be done with RUSAGE_SELF, by dint of the threading model.)
Closes https://github.com/facebook/hhvm/pull/3632

Reviewed By: @JoelMarcey

Differential Revision: D1530059
EZC: Fix count() and conversion to boolean of ProxyArray

Fix JIT versions of count() and conversion of array to boolean, so
that they work with ProxyArray. In both cases, duplicate the logic in
ArrayData::size() -- if the sign bit of the size field is unset, use
that field, otherwise call vsize().

The resulting generated machine code for conversion to boolean is along
the lines of:

  mov    0x4(%rdi),%eax
  test   %eax,%eax
  js     0xf80049b
  setne  %al

where 0xf80049b is the slow path. This is similar to the machine code I
previously reported for ArrayData::size() in code review of 1717e028f18
(see #3065).

Added test case which previously failed.