Fixed tempnam() creates paths with '//'

Sync with PHP's implementation

Closes #3313