Fix warnings in case of incorrect data

If somebody pass incorrect input array to `format`, php will raise several notices, because no any checks performed before access to array indexes.
Please review.
Actually not, at lease build machine checks this code and reports that evereything is ok.