$decode() ignores the padding switches. $decode() assumes that padding of some kind is used and deduces what it is based on the trailing characters.

As you say, zero padding is not reliable but not only because of the contexts you mention - different implementations may or may not extend zero padding with an extra block. So it may not even be compatible across implementations.

Originally, only PKCS#5 padding was supported. This is the recommended method. Some users requested the other padding methods, so they were added. It is left up to the scripter to decide which padding method to use.