Fix parameter order for sprintf

Swapped __CLASS__ and $replacement so that the error message is
correct.

Fixes #1058.