Updated php version to final spec, added phpunit testcases, couple of fixes