Weird history at its finest (I should've saved this one for Halloween LOL).
Once upon a time, in the year 896, there was a pope called Formosus. He was the sole pope to bear this monicker, as we shall soon see. Contemporary canon law prevented a bishop moving from one diocese to another, or ruling over more than one diocese at a time. Formosus was Bishop of Porto, a position he did not relinquish before becoming Bishop of Rome prior to being made pope. No one much bothered with the law at the time. But....
During his 5-year tenure as pope, Formosus fell afoul of a powerful Italian family, the Spoletos (not to be confused with the Sopranos LOL). One of the Spoletos, Guido, had been crowned Emperor or Rome by Formosus's papal predecessor. When Guido died, the Spoletos told Formosus to crown his son Lambert as Emperor in this palce. However, Formosus invited Arnulf, King of the Franks, to be Emperor instead, & crowned him at St Peter's.
Lambert's hot Italian blood was enraged by this. Alas for his vendetta, as Formosus died almost immediately afterward, thus cheating the Spoletos of their revenge. Formosus was succeeded by Boniface VI, who alas died after 15 days in office (shades of John Paul I). Boniface was succeeded by Stephen VI (also known sometimes as VII, as Stephen II, elected pope in 572 & has the record for shortest papacy at 5 days, was not consecrated as Bishop of Rome; the Second Vatican Council of the 1960s decided he therefore was not really a pope, thereby screwing up the numbering).
Stephen was tight with the Spoletos, who were still spoiling for revenge against Formosus. So he decided to put Formosus on trial for the aforementioned dual bishopric thing. Stephen called a synod in January 897 to do this. Of course everyone thought they were just going to basically trash Formosus posthumously.
Imagine their surprise when they walked into the Roman church of St John Lateran to view Formosus's reeking putrid corpse, in all its papally vestmented glory, having been summoned from the grave to appear & answer the charges against him! Crouching behind Formosus's chair was a young deacon who was to act as Formosus's "voice".
Stephen worked himself into an hysterical rage after reading the charges against the 9-months-dead pope, cursing the corpse & mocking its silence (the deacon apparently could not get a word in edgewise LOL). Formosus was found guilty & had his right hand cut off (the one with which he blessed people), & every decision he had made as pope was invalidated. His corpse was tossed into the Tiber, to be rescued by some enterprising souls & given decent Christian reburial.
The Roman folk, realizing they clearly had a nutcase of the first degree on the papal throne, rioted. The Spoletos tiptoed away & shrugged at that wacky Stephen's doings. Stephen was captured by the mob, imprisoned, & strangled to death. New papal election time LOL
Theodore II naturally said OK Stephen was a looney tune & I hereby rescind all this Formosus nonsense. Formosus was dug up AGAIN, redressed in his papal finery which had been stripped from his decaying corpse, & reburied AGAIN at St Peter's with full honors.
Serguis III, one of Stephen's supporters, was "elected" pope in 904 (that's in quotes as he blatantly murdered the competition & the cardinals said ooooook here have a nice papal hat ). Sergius declared Stephen's synod as valid & rescinded Theodore's rescinding (are we dizzy yet?). Thankfully he did NOT dig poor old Formosus up again when he did it.
Sergius's decision HAS NEVER BEEN REVERSED BY THE CATHOLIC CHURCH TO THIS DAY. So much for the concept of "papal infallibility" ROFL Theologians consider the Cadaver Synod as such an anamoly that it just plain "never happened".