Implement zend_fetch_class_by_name() and fix new_ZendObjectData_Instance()

* In Zend compat layer, implemented zend_fetch_class_by_name()
* Added relevant tests
* Fixed infinite loop in new_ZendObjectData_Instance() discovered in
  subsequent testing. You need a cursor to traverse a linked list.
EZC: Fix handling of exception types other than HPHP::Object

* Fixed ref counts
* Added tests
Remove .phpt files and remove a redundant clear()

Per ptarjan's comments on PR 1986.
EZC: Implement TSRM globals

* Implement TSRM globals properly, i.e. have different globals for
  different threads.
* Enable the ZTS macro. This is generally used by Zend extensions to
  know if they need to be thread-safe, so for HHVM best answer is yes,
  please do be thread-safe.
* Move ZendExtension to a separate header file, plus another for inline
  functions, to allow circular declarations. Having it in zend_modules.h
  didn't fit the recommended coding style in README.md.

The major implementation difficulty is ensuring that the existing
macros can transmit relevant data to the implementation, and ensuring
that the extern macro does actually give access to the globals. I would
have liked to put each module's globals in its own __thread variable,
but there was no way to supply the name of it to the constructor's
caller. Obviously you can't take the address of a __thread variable in
the zend_module_entry static initializer.

The implementation here is quite close to the Zend implementation,
except with an HPHP::ThreadLocal used for underlying storage. TSRMLS_CC
etc. is used as it is in Zend ZTS mode, and should provide a speedup
over TLS, especially with dynamic linking.
EZC: TSRM fixes

* Add TSRMLS_CC to the signature of PHP_FUNCTION() functions
* Move zend_wrap_func() to the .cpp file so that TSRM.h can be included
  without giving duplicate macro definitions throughout the non-EZC
  codebase.
EZC: Implement VCWD_*() functions

Also fix copy-and-paste job in fopen_wrappers.cpp. Reimplemented
expand_filepath_with_mode().
EZC: more TSRM fixes

* Allocate globals before MINIT, because REGISTER_INI_ENTRIES() is
  typically called from MINIT, and it accesses the module globals.
* Fix off-by-one error in ts_resource_from_vector()
EZC: fix bug in _zval_copy_ctor_func()

The type of the dest zval was copied from the source, but in the
KindOfStaticString case, the data of the dest zval is overwritten with a
plain string. This causes an assertion when the dest zval is used.

Enable the test which previously failed due to this bug.
EZC: fix compile error on gcc<4.8

_Unwind_Exception_Class is not defined, so use uint64_t per the ABI.