PHP fixes for spaces in ref attr