Just looked at that, but can't really find what's the real problem, or more, what would be the correct behavior. 

For example:
Given string: Test\\\Class\\\Thing
What should the escaped output be?
Test\\\\Class\\\\Thing or
Test\\\\\\Class\\\\\\Thing?

The hard thing is, that with 3 backslahes in the original string, you are already escaping the first one so in fact you have 2 backslashes, so the output should be 4 backslashes?
Or would you expect 6 backslashes because you should take it literal and need to escape every single one of them (and in that case, how would you even do that, I guess PHP only 'sees' 2 backslashes).