Add PHP tests and fix bug in PHP builtin driver