Fix PHP 5.3 compatibility (fixes #3)
Add test suite (fixes #4)