Don't set $_SERVER['HOSTNAME'] in CLI SAPI

..to match the behavior of Zend PHP.
Fix boundary cases of strspn, strcspn and substr_replace

I'm all for refactoring, but a precondition for refactoring is that the
original copies of the code in some way resemble each other. While the
bounds checks for strspn, substr_replace and substr might look
superficially similar, in fact they can't be merged with a single
simple if(strict) to take care of the divergence. The main problem is
that multi-pass normalization of the inputs gives you some interesting
and arguably broken behaviour when there are multiple issues that need
to be simultaneously fixed.

So, unrefactor (expand?) string_substr_check() into its three
consistutent parts, with code in the two new parts based closely on the
Zend source in the current git master. Remove the "strict" parameter,
now implicitly true.

Added a test case which previously failed in multiple ways. In
particular, strspn('','x') returned the wrong thing, which broke the
MediaWiki parser quite badly. The expect file was generated by PHP 5.5
and is identical to the one generated by PHP 5.3.

Submitted on behalf of a third-party: The PHP Group
Source: PHP 5.6.0-dev
License: version 3.01 of the PHP license
Split off libxml extension and convert to HNI

The libxml extension was in ext_simplexml.cpp. I don't think we need
multiple extensions per file. Also converted to HNI. Constant
registration was adapted from PHP 5.6.0-dev, using the libxml error
files as a source instead of hard-coding everything as is required by
constants.idl.json.

Moving LibXMLError from IDL to a systemlib fixes the serialization
failure which, despite being included in an expectf file, does not occur
in PHP. Updated the expectf file to match the PHP output.

* Made a header file for libxml_use_internal_error() and
  libxml_add_error() instead of repeating the definitions.
* Cache a Class pointer in a static variable, following
  the example of ReflectionException.
* Rename LibXmlErrors to LibXmlRequestData, since it contains more than
  just errors.

Submitted on behalf of a third-party: The PHP Group
Source: PHP 5.6.0-dev
License: version 3.01 of the PHP license
Optionally use timeout from GNU coreutils instead of bash hack

When using timeout.sh to run tests, test execution hangs until the
"sleep 1" finishes, probably because the monitor process keeps
filehandles open. If you instead use timeout from GNU coreutils, test
execution is about 2.5 times faster -- I measured a drop from 75 to 30
seconds for test/quick.