Just a quick tip: We encountered an upgrade error when going from 5.0.9 to 5.0.18 (mailboxd/jetty would not start, Illegal context spec:null, Error starting handlers, ...), because we previously had set the zimbraMailUrl value to " " (empty).
Before upgrading, set it back to "/zimbra" if you had changed it to avoid this mess.