Improve error messages from Filesystem::readRandomBytes()

Summary: Fixes T4153. Primarily, raise a better error message on Windows. Also make the function a little stricter and a little better tested.

Test Plan: Unit tests.

Reviewers: btrahan, hach-que

Reviewed By: hach-que

CC: aran

Maniphest Tasks: T4153

Differential Revision: https://secure.phabricator.com/D7650
Improve the performance of phutil_loggable_string()

Summary:
Ref T4162.

  - Before doing anything character oriented, test if the whole string is fine to print as-is.
  - Reduce the number of calls to `string()`.

Test Plan: Saw cost drop on profiles.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4162

Differential Revision: https://secure.phabricator.com/D7656
Support b'binary string' in XHPASTNode

Summary: Documented at [[ http://www.php.net/manual/en/language.types.type-juggling.php#language.types.typecasting | Type Casting ]].

Test Plan: New unit test.

Reviewers: epriestley, vinodsr

Reviewed By: epriestley

CC: Korvin, epriestley, aran, vinodsr

Differential Revision: https://secure.phabricator.com/D7662
Fix daemons erroring on already closed `STDOUT` and `STDERR`

Summary: Fixes T4177. This is the only "good" way of not erroring on these lines, because detecting truthyness doesn't always tell you everything.

Test Plan: after changing the lines, `tail`ed the log. Didn't see new errors coming in. Changed the lines back and saw the log growing quite quickly.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Maniphest Tasks: T4177

Differential Revision: https://secure.phabricator.com/D7674
Raise an exception if LDAP search fails

Summary: Currently, we assume search will always succeed if bind succeeds, but this isn't true in the wild. We don't have a root cause yet, but blunt this error into something vaguely useful rather than passing `null` to an `array` typehint and failing later and less usefully.

Test Plan: Used `bin/auth ldap`.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D7679