Fixed tempnam() creates paths with '//'

Summary: Sync with PHP's implementation

Closes #3313

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

Reviewed By: @ptarjan

Differential Revision: D1470642

Pulled By: svcscm
Fix bug with HashCollection::shrink()

Summary: This fixes a crashing bug related to HashCollection::shrink() where in some
cases it was allocating insufficient capacity and overrunning the buffer.

Reviewed By: @elgenie

Differential Revision: D1472072