Add more edge case tests matching the PHP 7 implementation