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.
If I understand the PHP documentation in the right way, this will cause a parse error.