While was trading with my perfect paper villager, the paper trade stopped working. I looked in his trades and there were 9 of them, the last one being the gold trade. Basicly what I'm saying is a white villager had 9 trade slots. As far as my knowledge goes, they can only have 8. Is this a bug or is this possible in the code?
This is NOT a bug. There is a ultra rare chance of a 9th slot gold trade. I myself have seen it.
also in 1.8 there are not perfect villagers, so even if classed as a bug, it will be of no consequence shortly.
However perfect paper traders (8th slot) has been determined to happen roughly 1 in 11 librarians (from a 100 million sample , if you can get all the librarian trades unlocked, which can take a lot of emeralds and work. So if this happens, you are better off just continuing your search.
See Forum discussion
http://www.minecraftforum.net/topic/1762291-/page__st__20#entry24298520
PS: 2 perfect paper traders are better than 1, as you can then jump from one to the other, while they reset. Also I find written book traders better still, if you have a ink farm.