In mysql_escape_string() use ReserveString instead of AttachString

* Use ReserveString instead of AttachString in mysql_escape_string()
  and mysql_real_escape_string(). AttachString should really be
  deprecated, since it doesn't actually attach, it just copies.
* Don't truncate the return value of the underlying C API call -- use
  unsigned long.
* Upgrade string size to size_t before doing arithmetic. Overflow is
  probably not possible in this case, but it's a good habit to get into.
* Added missing skipif.inc from PHP, so that the relevant tests would
  run.

Submitted on behalf of a third-party: The PHP Group
Source: PHP 5.7.0-dev
License: version 3.01 of the PHP license