Validate session ID

This patch backports behaviour added in PHP Core 5.5.2